Skip to content

Commit

Permalink
fix: apply expo-asset patch from expo/expo#24562
Browse files Browse the repository at this point in the history
  • Loading branch information
byCedric committed Sep 21, 2023
1 parent 0b53403 commit 80dbda8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,10 @@
"resolutions": {
"react-refresh": "~0.14.0"
},
"private": true
"private": true,
"pnpm": {
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
}
}
}
24 changes: 24 additions & 0 deletions patches/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/tools/hashAssetFiles.js b/tools/hashAssetFiles.js
index c118dcf1efc32b509f83df314e15de2a8ea9e1b0..c88088736a79b00645ca85d04bb9a4d936e4af47 100644
--- a/tools/hashAssetFiles.js
+++ b/tools/hashAssetFiles.js
@@ -15,6 +15,19 @@ module.exports = function hashAssetFiles(asset) {
.replace(/\.\.\//g, '_');
}

+ // URL encode asset paths defined as `?export_path` or `?unstable_path` query parameters.
+ // Decoding should be done automatically when parsing the URL through Node or the browser.
+ const assetPathQueryParameter = asset.httpServerLocation.match(
+ /\?(export_path|unstable_path)=(.*)/
+ );
+ if (assetPathQueryParameter && assetPathQueryParameter[2]) {
+ const assetPath = assetPathQueryParameter[2];
+ asset.httpServerLocation = asset.httpServerLocation.replace(
+ assetPath,
+ encodeURIComponent(assetPath)
+ );
+ }
+
return asset;
});
};

0 comments on commit 80dbda8

Please sign in to comment.