diff --git a/CHANGELOG.md b/CHANGELOG.md index 67e2b8fd1..abf6c7578 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h ## [Unreleased] +### Fixed +* [#2721](https://github.com/Shopify/shopify-cli/pull/2721): Do not `replace_asset_urls` in font bodies + ### Added * [#2724](https://github.com/Shopify/shopify-cli/pull/2724): Introduce hidden `--overwrite-json` flag diff --git a/lib/shopify_cli/theme/dev_server/local_assets.rb b/lib/shopify_cli/theme/dev_server/local_assets.rb index ec4d9a4da..94e952862 100644 --- a/lib/shopify_cli/theme/dev_server/local_assets.rb +++ b/lib/shopify_cli/theme/dev_server/local_assets.rb @@ -29,13 +29,14 @@ def initialize(ctx, app, target) end def call(env) - if env["PATH_INFO"].start_with?("/assets") + path_info = env["PATH_INFO"] + if path_info.start_with?("/assets") # Serve from disk - serve_file(env["PATH_INFO"]) + serve_file(path_info) else # Proxy the request, and replace the URLs in the response status, headers, body = @app.call(env) - body = replace_asset_urls(body) + body = replace_asset_urls(body) unless path_info.start_with?("/fonts") [status, headers, body] end end @@ -53,6 +54,10 @@ def replace_asset_urls(body) end [replaced_body] + rescue ArgumentError => error + return [body.join] if error.message.include?("invalid byte sequence") + + raise error end def serve_fail(status, body)