Skip to content

Commit

Permalink
fix: return plaintext 404 for anything under appDir (#11597)
Browse files Browse the repository at this point in the history
Co-authored-by: Rich Harris <[email protected]>
  • Loading branch information
Rich-Harris and Rich-Harris committed Jan 11, 2024
1 parent 48576de commit 553e14c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-clocks-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: return plaintext 404 for anything under appDir
4 changes: 4 additions & 0 deletions packages/kit/src/runtime/server/respond.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ export async function respond(request, options, manifest, state) {
return get_public_env(request);
}

if (decoded.startsWith(`/${options.app_dir}`)) {
return text('Not found', { status: 404 });
}

const is_data_request = has_data_suffix(decoded);
/** @type {boolean[] | undefined} */
let invalidated_data_nodes;
Expand Down

0 comments on commit 553e14c

Please sign in to comment.