fix: basePath handling for assets#3423
Conversation
065aea1 to
b49111d
Compare
|
A few things I noticed:
|
# Conflicts: # packages/plugin-vite/tests/build_test.ts
1. Make basePath a module-level variable (like BUILD_ID) instead of threading it through asset()/assetSrcSet() parameters. The public API no longer exposes basePath — it's set once via setBasePath() during app.handler() initialization. 2. Guard applyBasePath against double-prefixing — if the path already starts with basePath, return it unchanged. 3. Improve basePath validation — use URL round-trip check instead of an incomplete character regex, catching all invalid path characters. 4. Island CSS paths confirmed safe — they are root-relative from the build system and never include basePath, so applyBasePath (now via asset()) is correct. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts: # packages/fresh/src/app.ts # packages/plugin-vite/tests/build_test.ts
The @ character is valid in URL paths, so it should no longer be rejected. Updated test to match the new URL-based validation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Actually I'm gonna close this one since the original issue is now fixed. |
Pull request was closed
trying to fix #3391 again, this gets a bit hairy, it forces propagating the basePath through the runtime.
Well, this code may not win a beauty contest, but so far it seems work and handle the mentioned cases.
Please review, check, flame me and revert my previous basePath PRs if this path is too much of a rabbit hole 😄