Repository navigation
Report CdnPreconnect for cdn.shopify.com without a path - #1366
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are you adding in this PR?
Fixes #1365
CdnPreconnectmatched thehrefwith.+cdn.shopify.com.+. The pattern needs a character after the host, so<link rel="preconnect" href="https://cdn.shopify.com" crossorigin>andhref="//cdn.shopify.com"were never reported. The unescaped, unanchored pattern also reported other hosts, such ashttps://example.com/cdn.shopify.com.html.The check now matches
(https?:)?//cdn\.shopify\.com(/\S*)?, so it reports the Shopify CDN origin with or without a path, and only when it is the host.What's next? Any followup issues?
None.
What did you learn?
The Ruby version of this check reported any
hrefthat containedcdn.shopify.com, so the bare origin case regressed in the port.Tophatting
New spec cases in
packages/theme-check-common/src/checks/cdn-preconnect/index.spec.tscover the bare origin, the protocol-relative origin, and a non-Shopify host. They fail onmain(2 failed, 3 passed) and pass with this change (5 passed).npx vitest run packages/theme-check-commonpasses (5367 tests).I added screenshots of the changes (before and after the changes if applicable)
Before you deploy
changeset