Skip to content

fix: ignore the query string and hash of an imported asset's URL when using read - #17507

Merged
elliott-with-the-longest-name-on-github merged 4 commits into
mainfrom
teemingc/read-dev-query-17506
Oct 30, 2026
Merged

elliott-with-the-longest-name-on-github merged 4 commits into
mainfrom
teemingc/read-dev-query-17506

Conversation

@teemingc

@teemingc teemingc commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

closes #17506

Vite keeps part of an import's query or hash on the asset URL: in dev everything except url (e.g. /src/routes/file.txt?no-inline), and in build anything other than its own queries (e.g. ./file.txt?url&v=1 becomes /_app/immutable/assets/file.HASH.txt?v=1). read didn't strip it, so it looked up a file whose name included the query and threw read_asset_missing.

read now strips everything from the first ? or # before resolving the file, using the same /[?#].*$/ replace as Vite's own cleanUrl. Vite treats the first ? or # as the end of the file path everywhere, so files with those characters in their names can't be imported in the first place, and the stripped part is never part of a real filename.

Tests: basics /read-file now also reads an asset imported with ?url&no-inline&v=1. It fails without this change in both dev and build.

teemingc and others added 2 commits October 21, 2026 23:18
… dev

Vite keeps queries such as `?no-inline` on asset URLs in dev, which made
`read` look for a file whose name included the query.

closes #17506

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@pkg-svelte-dev

pkg-svelte-dev Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from b7b3f6d:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/b7b3f6dd9c6a27b0c36d251c782dd8cce55bff46

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/17507

@changeset-bot

changeset-bot Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b7b3f6d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svelte-docs-bot

Copy link
Copy Markdown

Vite only removes its own queries (e.g. `?url`, `?no-inline`) from built
asset URLs, so a query like `?v=1` or a hash broke `read` in production
too. The test now uses `?url&no-inline&v=1`, which fails on main in both
dev and build.
@teemingc teemingc changed the title fix: ignore query strings when using read on imported assets during dev fix: ignore the query string and hash of an imported asset's URL when using read Oct 21, 2026
@elliott-with-the-longest-name-on-github
elliott-with-the-longest-name-on-github merged commit 3562454 into main Oct 30, 2026
41 checks passed
@elliott-with-the-longest-name-on-github
elliott-with-the-longest-name-on-github deleted the teemingc/read-dev-query-17506 branch October 30, 2026 20:53
@github-actions github-actions Bot mentioned this pull request Oct 30, 2026
teemingc pushed a commit that referenced this pull request Nov 10, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @sveltejs/[email protected]

### Minor Changes

- feat: Add clickable links to remote function invocation in dev server
logs ([#17547](#17547))

### Patch Changes

- fix: reject URL inputs in `resolve`
([#17627](#17627))

- fix: respond with JSON instead of rendering the error page for a
`__data.json` request to a missing route
([#17630](#17630))

- fix: resolve relative paths against the page URL in data requests when
`paths.relative` is `true`
([#17630](#17630))

- fix: reject binary remote forms referencing files with an empty
file-offset table as 400 Bad Request
([#17579](#17579))

- fix: correctly populate route and params for `afterNavigate` during
hydration ([#17577](#17577))

- fix: include assets imported through dynamic imports, remote functions
and param matchers in `builder.findServerAssets` so that `read` can find
them ([#17505](#17505))

- fix: set `navigation.from` to `null` in `afterNavigate` on start when
SSR is disabled ([#17587](#17587))

- fix: include remote function name and declaration file in schema
validation failure logs
([#17495](#17495))

- fix: reuse SSR results of remote functions from packages during
hydration in dev ([#17604](#17604))

- fix: remove empty type output directories for removed routes
([#17472](#17472))

- fix: use the UTF-8 byte length when reading inline assets
([#17590](#17590))

- chore: simplify a few server and build helpers
([#17531](#17531))

- fix: ignore the query string and hash of an imported asset's URL when
using `read` ([#17507](#17507))

- fix: avoid reloading unrelated server modules when saving files during
development ([#17462](#17462))
## @sveltejs/[email protected]

### Patch Changes

- fix: apply the Vite config and plugins of the detected adapter
([#17572](#17572))
- Updated dependencies:
  - @sveltejs/[email protected]
## @sveltejs/[email protected]

### Patch Changes

- fix: serve client and prerendered files whichever way the request path
is percent-encoded, and allow `*` and a leading `:` in their filenames
([#17123](#17123))

- perf: let Bun serve immutable files without calling into JavaScript
([#17123](#17123))

- fix: support the `ORIGIN` environment variable when `paths.origin` is
not set ([#17632](#17632))
- Updated dependencies:
  - @sveltejs/[email protected]
## @sveltejs/[email protected]

### Patch Changes

- fix: ignore `Range` headers on `HEAD` requests for static assets
([#17602](#17602))

- fix: respond with a 500 instead of crashing the server when handling a
request fails unexpectedly
([#17696](#17696))

- fix: support the `ORIGIN` environment variable when `paths.origin` is
not set ([#17632](#17632))
- Updated dependencies:
  - @sveltejs/[email protected]
## @sveltejs/[email protected]

### Patch Changes

- fix: accept every Node.js version from 26 (`nodejs27.x`, `nodejs28.x`,
...), not only even ones
([#17584](#17584))

- fix: serve prerendered pages when `paths.base` is set
([#17525](#17525))
- Updated dependencies:
  - @sveltejs/[email protected]
## @sveltejs/[email protected]

### Patch Changes

- fix: compute the missing `width` or `height` at runtime for images
imported in the script, instead of outputting `NaN`
([#17499](#17499))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit to clement-songis/sveltekit-adapter-bun that referenced this pull request Nov 14, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @sveltejs/[email protected]

### Minor Changes

- feat: Add clickable links to remote function invocation in dev server
logs ([#17547](sveltejs/kit#17547))

### Patch Changes

- fix: reject URL inputs in `resolve`
([#17627](sveltejs/kit#17627))

- fix: respond with JSON instead of rendering the error page for a
`__data.json` request to a missing route
([#17630](sveltejs/kit#17630))

- fix: resolve relative paths against the page URL in data requests when
`paths.relative` is `true`
([#17630](sveltejs/kit#17630))

- fix: reject binary remote forms referencing files with an empty
file-offset table as 400 Bad Request
([#17579](sveltejs/kit#17579))

- fix: correctly populate route and params for `afterNavigate` during
hydration ([#17577](sveltejs/kit#17577))

- fix: include assets imported through dynamic imports, remote functions
and param matchers in `builder.findServerAssets` so that `read` can find
them ([#17505](sveltejs/kit#17505))

- fix: set `navigation.from` to `null` in `afterNavigate` on start when
SSR is disabled ([#17587](sveltejs/kit#17587))

- fix: include remote function name and declaration file in schema
validation failure logs
([#17495](sveltejs/kit#17495))

- fix: reuse SSR results of remote functions from packages during
hydration in dev ([#17604](sveltejs/kit#17604))

- fix: remove empty type output directories for removed routes
([#17472](sveltejs/kit#17472))

- fix: use the UTF-8 byte length when reading inline assets
([#17590](sveltejs/kit#17590))

- chore: simplify a few server and build helpers
([#17531](sveltejs/kit#17531))

- fix: ignore the query string and hash of an imported asset's URL when
using `read` ([#17507](sveltejs/kit#17507))

- fix: avoid reloading unrelated server modules when saving files during
development ([#17462](sveltejs/kit#17462))
## @sveltejs/[email protected]

### Patch Changes

- fix: apply the Vite config and plugins of the detected adapter
([#17572](sveltejs/kit#17572))
- Updated dependencies:
  - @sveltejs/[email protected]
## @sveltejs/[email protected]

### Patch Changes

- fix: serve client and prerendered files whichever way the request path
is percent-encoded, and allow `*` and a leading `:` in their filenames
([#17123](sveltejs/kit#17123))

- perf: let Bun serve immutable files without calling into JavaScript
([#17123](sveltejs/kit#17123))

- fix: support the `ORIGIN` environment variable when `paths.origin` is
not set ([#17632](sveltejs/kit#17632))
- Updated dependencies:
  - @sveltejs/[email protected]
## @sveltejs/[email protected]

### Patch Changes

- fix: ignore `Range` headers on `HEAD` requests for static assets
([#17602](sveltejs/kit#17602))

- fix: respond with a 500 instead of crashing the server when handling a
request fails unexpectedly
([#17696](sveltejs/kit#17696))

- fix: support the `ORIGIN` environment variable when `paths.origin` is
not set ([#17632](sveltejs/kit#17632))
- Updated dependencies:
  - @sveltejs/[email protected]
## @sveltejs/[email protected]

### Patch Changes

- fix: accept every Node.js version from 26 (`nodejs27.x`, `nodejs28.x`,
...), not only even ones
([#17584](sveltejs/kit#17584))

- fix: serve prerendered pages when `paths.base` is set
([#17525](sveltejs/kit#17525))
- Updated dependencies:
  - @sveltejs/[email protected]
## @sveltejs/[email protected]

### Patch Changes

- fix: compute the missing `width` or `height` at runtime for images
imported in the script, instead of outputting `NaN`
([#17499](sveltejs/kit#17499))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
dadezzz pushed a commit to dadezzz/events-cash-register that referenced this pull request Nov 15, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [@sveltejs/kit](https://svelte.dev) ([source](https://github.com/sveltejs/kit/tree/HEAD/packages/kit)) | [`3.1.1` → `3.2.0`](https://renovatebot.com/diffs/npm/@sveltejs%2fkit/3.1.1/3.2.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@sveltejs%2fkit/3.2.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@sveltejs%2fkit/3.1.1/3.2.0?slim=true) |

---

### Release Notes

<details>
<summary>sveltejs/kit (@&#8203;sveltejs/kit)</summary>

### [`v3.2.0`](https://github.com/sveltejs/kit/blob/HEAD/packages/kit/CHANGELOG.md#320)

[Compare Source](https://github.com/sveltejs/kit/compare/@sveltejs/[email protected]...@sveltejs/[email protected])

##### Minor Changes

- feat: Add clickable links to remote function invocation in dev server logs ([#&#8203;17547](sveltejs/kit#17547))

##### Patch Changes

- fix: reject URL inputs in `resolve` ([#&#8203;17627](sveltejs/kit#17627))

- fix: respond with JSON instead of rendering the error page for a `__data.json` request to a missing route ([#&#8203;17630](sveltejs/kit#17630))

- fix: resolve relative paths against the page URL in data requests when `paths.relative` is `true` ([#&#8203;17630](sveltejs/kit#17630))

- fix: reject binary remote forms referencing files with an empty file-offset table as 400 Bad Request ([#&#8203;17579](sveltejs/kit#17579))

- fix: correctly populate route and params for `afterNavigate` during hydration ([#&#8203;17577](sveltejs/kit#17577))

- fix: include assets imported through dynamic imports, remote functions and param matchers in `builder.findServerAssets` so that `read` can find them ([#&#8203;17505](sveltejs/kit#17505))

- fix: set `navigation.from` to `null` in `afterNavigate` on start when SSR is disabled ([#&#8203;17587](sveltejs/kit#17587))

- fix: include remote function name and declaration file in schema validation failure logs ([#&#8203;17495](sveltejs/kit#17495))

- fix: reuse SSR results of remote functions from packages during hydration in dev ([#&#8203;17604](sveltejs/kit#17604))

- fix: remove empty type output directories for removed routes ([#&#8203;17472](sveltejs/kit#17472))

- fix: use the UTF-8 byte length when reading inline assets ([#&#8203;17590](sveltejs/kit#17590))

- chore: simplify a few server and build helpers ([#&#8203;17531](sveltejs/kit#17531))

- fix: ignore the query string and hash of an imported asset's URL when using `read` ([#&#8203;17507](sveltejs/kit#17507))

- fix: avoid reloading unrelated server modules when saving files during development ([#&#8203;17462](sveltejs/kit#17462))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yMzcuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjIzNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
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.

read fails for assets whose URL keeps a query or hash, e.g. ?url&v=1

2 participants