Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 8 additions & 3 deletions lib/shopify_cli/theme/dev_server/local_assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down