Skip to content

Commit

Permalink
fix(public-assets): do not shadow paths that share prefix (#2516)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Jun 12, 2024
1 parent c9a7afc commit 72db848
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/rollup/plugins/public-assets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { promises as fsp } from "node:fs";
import { relative, resolve } from "pathe";
import { withTrailingSlash } from "ufo";
import createEtag from "etag";
import mime from "mime";
import { globby } from "globby";
Expand Down Expand Up @@ -112,7 +113,10 @@ export function readAsset (id) {
const publicAssetBases = Object.fromEntries(
nitro.options.publicAssets
.filter((dir) => !dir.fallthrough && dir.baseURL !== "/")
.map((dir) => [dir.baseURL, { maxAge: dir.maxAge }])
.map((dir) => [
withTrailingSlash(dir.baseURL),
{ maxAge: dir.maxAge },
])
);

// prettier-ignore
Expand Down

0 comments on commit 72db848

Please sign in to comment.