Skip to content

fix(storage-*): simplify key handling for signed urls and composite prefixes#16291

Merged
JarrodMFlesch merged 5 commits intomainfrom
fix/storage-adapters-getFileKey-signed-urls
Apr 16, 2026
Merged

fix(storage-*): simplify key handling for signed urls and composite prefixes#16291
JarrodMFlesch merged 5 commits intomainfrom
fix/storage-adapters-getFileKey-signed-urls

Conversation

@JarrodMFlesch
Copy link
Copy Markdown
Contributor

@JarrodMFlesch JarrodMFlesch commented Apr 15, 2026

Summary

This PR primarily fixes inconsistent storage key and prefix behavior across adapters and client upload flows. The main goal is to make signed URL generation, object lookup/delete, and client upload path handling behave the same way for S3, GCS, Azure, R2, and Vercel Blob, especially when composite prefixes are enabled.

Fixes

This change fixes prefix/key mismatch issues by standardizing how adapters derive object keys, and resolves edge cases where client-uploaded files could diverge from server-side prefix/filename semantics. It also fixes GCS URL generation behavior by preserving canonical encoded public URLs instead of decoding them.

Additional cleanup

As part of the fix work, getFileKey was expanded to return normalized key components so adapters can consume one shared source of truth rather than rebuilding path logic in multiple places. This reduces duplication and makes future storage fixes safer.

Validation

Composite-prefix client upload coverage was added for Vercel Blob to protect the fixed behavior and prevent regressions in key/prefix handling.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

📦 esbuild Bundle Analysis for payload

This analysis was generated by esbuild-bundle-analyzer. 🤖
This PR introduced no changes to the esbuild bundle! 🙌

@JarrodMFlesch JarrodMFlesch changed the title fix(storage): simplify key handling for signed urls and composite prefixes fix(storage-*): simplify key handling for signed urls and composite prefixes Apr 15, 2026
@JarrodMFlesch JarrodMFlesch changed the title fix(storage-*): simplify key handling for signed urls and composite prefixes storage-*: simplify key handling for signed urls and composite prefixes Apr 15, 2026
@JarrodMFlesch JarrodMFlesch changed the title storage-*: simplify key handling for signed urls and composite prefixes fix(storage-*): simplify key handling for signed urls and composite prefixes Apr 15, 2026
@JarrodMFlesch JarrodMFlesch marked this pull request as ready for review April 15, 2026 20:30
@JarrodMFlesch JarrodMFlesch requested a review from denolfe as a code owner April 15, 2026 20:30
@JarrodMFlesch JarrodMFlesch enabled auto-merge (squash) April 16, 2026 18:10
@JarrodMFlesch JarrodMFlesch merged commit 6139508 into main Apr 16, 2026
330 of 332 checks passed
@JarrodMFlesch JarrodMFlesch deleted the fix/storage-adapters-getFileKey-signed-urls branch April 16, 2026 18:16
milamer pushed a commit to milamer/payload that referenced this pull request Apr 20, 2026
…refixes (payloadcms#16291)

## Summary

This PR primarily fixes inconsistent storage key and prefix behavior
across adapters and client upload flows. The main goal is to make signed
URL generation, object lookup/delete, and client upload path handling
behave the same way for S3, GCS, Azure, R2, and Vercel Blob, especially
when composite prefixes are enabled.

## Fixes

This change fixes prefix/key mismatch issues by standardizing how
adapters derive object keys, and resolves edge cases where
client-uploaded files could diverge from server-side prefix/filename
semantics. It also fixes GCS URL generation behavior by preserving
canonical encoded public URLs instead of decoding them.

## Additional cleanup

As part of the fix work, getFileKey was expanded to return normalized
key components so adapters can consume one shared source of truth rather
than rebuilding path logic in multiple places. This reduces duplication
and makes future storage fixes safer.

## Validation

Composite-prefix client upload coverage was added for Vercel Blob to
protect the fixed behavior and prevent regressions in key/prefix
handling.
@github-actions
Copy link
Copy Markdown
Contributor

🚀 This is included in version v3.84.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants