Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only replace font urls when content type is not present or it is a text #1867

Merged
merged 5 commits into from
May 2, 2023

Conversation

yknx4
Copy link
Contributor

@yknx4 yknx4 commented Apr 28, 2023

WHY are these changes introduced?

Fixes https://github.com/Shopify/assets/issues/653

New vanity urls are breaking theme development

related to #1862

WHAT is this pull request doing?

Ensure the fonts url replacement only happens on text assets (or when content type is not present)

How to test your changes?

bundle exec rake test TEST=test/shopify-cli/theme/dev_server/cdn_fonts_test.rb

OR

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've made sure that any changes to dev or deploy have been reflected in the internal flowchart.

@yknx4 yknx4 requested a review from a team April 28, 2023 19:05
@github-actions

This comment has been minimized.

@yknx4 yknx4 requested review from JLoppert and joshuamsager April 28, 2023 19:08
@github-actions
Copy link
Contributor

github-actions bot commented Apr 28, 2023

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 72.84% 4359/5984
🟡 Branches 69.46% 2013/2898
🟡 Functions 69.95% 1145/1637
🟡 Lines 74.26% 4166/5610

Test suite run success

1133 tests passing in 548 suites.

Report generated by 🧪jest coverage report action from eb0f06f

if content_type.nil? || content_type == "" || content_type&.start_with?("text/")
Rack::Response.new(replace_font_urls(body), status, headers).finish
else
Rack::Response.new(body, status, headers).finish
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was concerned that this changes the response type from an array to an object, but this returns the same 3 tuple array.

https://www.rubydoc.info/github/rack/rack/Rack%2FResponse:finish

👍

@yknx4 yknx4 requested a review from amcaplan May 1, 2023 17:09
Copy link
Contributor

@amcaplan amcaplan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for this! 🎉 🚀

@amcaplan
Copy link
Contributor

amcaplan commented May 2, 2023

By the way, PLEASE do add a changeset before merging. So we can include the fix in the changelog. pnpm changeset add

@amcaplan
Copy link
Contributor

amcaplan commented May 2, 2023

And the changeset should be patch-level!

@JLoppert
Copy link

JLoppert commented May 2, 2023

@isaacroldan isaacroldan added this pull request to the merge queue May 2, 2023
Merged via the queue into main with commit 8297e23 May 2, 2023
@isaacroldan isaacroldan deleted the fix-vanity-url-proxy branch May 2, 2023 13:13
@shopify-shipit shopify-shipit bot temporarily deployed to nightly May 2, 2023 13:42 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to production May 22, 2023 14:30 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants