Skip to content

fix: forward download precondition headers - #1467

Merged
ferhatelmas merged 2 commits into
supabase:masterfrom
hsusul:fix/storage-download-preconditions
Oct 6, 2026
Merged

ferhatelmas merged 2 commits into
supabase:masterfrom
hsusul:fix/storage-download-preconditions

Conversation

@hsusul

@hsusul hsusul commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1466.

Forward If-Match and If-Unmodified-Since from ordinary REST object downloads to the existing backend precondition support.

Problem and solution

AssetRenderer.getAsset drops these headers, so a guarded ranged download can return 206 with changed object bytes instead of 412. Public, authenticated, and signed object downloads share this renderer. The fix adds only the two missing header mappings; existing backend semantics and error handling remain unchanged.

Related #1446 implemented S3-route/backend support, not this REST renderer mapping. No public API, schema, dependencies, or authorization behavior changes. No documentation changes are needed.

Regression proof

The actual public-object route, renderer, file backend, and REST error handler are exercised with temporary local files. Only database lookups and xattr metadata access are stubbed; no credentials or live services are required.

  • On clean master eccef5e70a67fb4030e0646e5e22602c94f568bc, stale If-Match plus a range fails the regression: 206 instead of 412. Forwarding the header makes it pass.
  • The date precondition independently fails with 200 instead of 412, then passes after its header is forwarded.
  • Seven tests cover both failures, ordinary reads, matching ranged reads, precondition precedence, matching dates, and existing 304 revalidation.

Validation

  • Focused route/renderer/backend/error-handler tests: 197 passed.
  • Full unit suite: 2,571 tests passed across 160 files (npm run test:unit -- --maxWorkers=2 --testTimeout=60000 --hookTimeout=60000).
  • npm run build, npm run lint (including repository-wide formatting), focused Prettier check, and git diff --check: passed.
  • Database integration tests: not run. Unrelated services occupy the required PostgreSQL ports; they were left untouched.

The first full unit run had 2,570 passes and one unrelated tracing shutdown-hook timeout at 30 seconds. That file passes in isolation on unchanged upstream and this worktree. The full retry uses CLI-only 60-second test/hook allowances, without changing repository configuration.

@hsusul
hsusul requested a review from a team as a code owner October 2, 2026 18:55
@coveralls

coveralls commented Oct 2, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 37467937690

Coverage increased (+0.02%) to 84.461%

Details

  • Coverage increased (+0.02%) from the base build.
  • Patch coverage: 4 of 4 lines across 2 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 14444
Covered Lines: 12640
Line Coverage: 87.51%
Relevant Branches: 8878
Covered Branches: 7058
Branch Coverage: 79.5%
Branches in Coverage %: Yes
Coverage Strength: 776.51 hits per line

💛 - Coveralls

hsusul and others added 2 commits October 6, 2026 14:22
Signed-off-by: Ferhat Elmas <elmas.ferhat@gmail.com>
@ferhatelmas
ferhatelmas force-pushed the fix/storage-download-preconditions branch from 6064ba2 to 2a3c1b2 Compare October 6, 2026 13:04
@ferhatelmas ferhatelmas changed the title fix(storage): forward download precondition headers fix: forward download precondition headers Oct 6, 2026
@ferhatelmas
ferhatelmas enabled auto-merge (squash) October 6, 2026 13:05
@ferhatelmas
ferhatelmas merged commit 88cae8a into supabase:master Oct 6, 2026
32 checks passed
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.

REST object downloads ignore If-Match and If-Unmodified-Since

3 participants