Skip to content

Commit

Permalink
fix: don't escape base path in ecmascript runtime to allow for URLs (v…
Browse files Browse the repository at this point in the history
…ercel/turborepo#7093)

### Description

next's asset prefix can be a full URL, I think we can assume that the
basepath itself is valid.
we probably also want to ensure that the `chunkPath` never contains
invalid URL characters at build time so we don't need to escape anything
at all at runtime.

Need to make sure it passes all next.js tests
#61090

Closes PACK-2282
  • Loading branch information
ForsakenHarmony authored Jan 24, 2024
1 parent 0db6e92 commit c02de4d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1291,10 +1291,10 @@ function getOrInstantiateRuntimeModule(
* Returns the URL relative to the origin where a chunk can be fetched from.
*/
function getChunkRelativeUrl(chunkPath: ChunkPath): string {
return `${CHUNK_BASE_PATH}${chunkPath}`
return `${CHUNK_BASE_PATH}${chunkPath
.split("/")
.map((p) => encodeURIComponent(p))
.join("/");
.join("/")}`;
}

/**
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

0 comments on commit c02de4d

Please sign in to comment.