Skip to content

Fix local resource file URLs with hashes#8607

Open
tianheng2017 wants to merge 5 commits into
4ian:masterfrom
tianheng2017:fix-resource-file-url-hash-preview
Open

Fix local resource file URLs with hashes#8607
tianheng2017 wants to merge 5 commits into
4ian:masterfrom
tianheng2017:fix-resource-file-url-hash-preview

Conversation

@tianheng2017
Copy link
Copy Markdown

@tianheng2017 tianheng2017 commented May 16, 2026

Summary

  • Encode Electron local resource file URLs with Node's pathToFileURL so reserved characters like # are preserved as part of the path.
  • Decode file URLs back to local paths with fileURLToPath for resource file actions.
  • Encode local/runtime resource URLs before cache-busting or token parameters are appended, so # is not interpreted as a URL fragment in previews or exported games.
  • Add focused regression coverage for a local resource path containing a hash and cache-busting parameters.

Fixes #4015.

Tests

  • CI=true react-app-rewired test --env=node --runInBand --watchAll=false src/ResourcesList/ResourceUtils.spec.js
  • CI=true react-app-rewired test --env=node --runInBand --watchAll=false src/ResourcesList/ResourceUrlEncoding.spec.js
  • npm run flow
  • npm run check-format (in newIDE/app)
  • npm run check-types -- --pretty false (in GDJS)
  • npx prettier --list-different Runtime/ResourceLoader.ts (in GDJS)
  • git diff --check

@tianheng2017
Copy link
Copy Markdown
Author

CI note for the latest commit (9ad135c): the project checks exercised by this PR are passing locally and in CI where they are not blocked by generated artifacts.

Local checks:

  • CI=true react-app-rewired test --env=node --runInBand --watchAll=false src/ResourcesList/ResourceUtils.spec.js
  • CI=true react-app-rewired test --env=node --runInBand --watchAll=false src/ResourcesList/ResourceUrlEncoding.spec.js
  • npm run flow
  • npm run check-format in newIDE/app
  • npm run check-types -- --pretty false in GDJS
  • targeted Prettier check for GDJS/Runtime/ResourceLoader.ts
  • git diff --check

Semaphore is red, but the latest logs show npm run flow finishes with No errors!; the failing step is npm run check-script-types, where TypeScript parses the downloaded generated ../public/libGD.js and errors at line 22. The newIDE tests job is failing on the same generated libGD.js-for-tests-only parse issue before the resource URL tests are exercised. GDJS typing/tests and newIDE format/lint are green on Semaphore.

@tianheng2017
Copy link
Copy Markdown
Author

Follow-up update: I added commit \d9a4aa3\ to improve the \libGD.js\ download fallback used by newIDE CI. This mirrors the master-commit fallback behavior that avoids using an incompatible generated \libGD.js\ artifact when the PR branch artifact is unavailable.\n\nRe-verified locally after the update:\n- \
ode --check scripts/import-libGD.js\\n- \
px prettier --list-different scripts/import-libGD.js\\n- \CI=true react-app-rewired test --env=node --runInBand --watchAll=false src/ResourcesList/ResourceUtils.spec.js\\n- \CI=true react-app-rewired test --env=node --runInBand --watchAll=false src/ResourcesList/ResourceUrlEncoding.spec.js\\n- \
pm run flow\\n- \
pm run check-format\\n- \
pm run check-types -- --pretty false\ in \GDJS\\n- \git diff --check\\n\nThe new Semaphore/Travis runs are queued now.

@tianheng2017
Copy link
Copy Markdown
Author

Latest update for commit \ 793927: Semaphore is now green. I fixed the Linux/Windows path expectation in the local file URL decoding regression test and re-verified locally:\n\n- \CI=true npx react-app-rewired test --env=node --runInBand --watchAll=false src/ResourcesList/ResourceUtils.spec.js\n- \CI=true npx react-app-rewired test --env=node --runInBand --watchAll=false src/ResourcesList/ResourceUrlEncoding.spec.js\n-
pm run flow\n-
pm run check-format\n- \git diff --check\n\nTravis is still queued/pending.

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.

[$20.00 bounty] In a filepath a hashtag broke the preview

1 participant