Skip to content

Conversation

@jhb-dev
Copy link
Contributor

@jhb-dev jhb-dev commented Oct 31, 2025

What

This PR updates the getGenerateURL function in the s3-storage adapter to properly encode filenames using encodeURIComponent when constructing file URLs. This ensures that the URL is properly encoded when using the disablePayloadAccessControl option.

Why

Without URL encoding, filenames containing special characters (spaces, unicode characters, special symbols, etc.) can break URL generation and lead to:

  • 404 errors when accessing files with special characters
  • Malformed URLs that don't properly resolve
  • Security issues with improperly escaped characters

How

The fix wraps the filename parameter with encodeURIComponent() in the URL construction, similar to how it is done in the storage-vercel-blob package.

Example:

  • Before: https://s3.endpoint.com/bucket/my file.jpg (breaks)
  • After: https://s3.endpoint.com/bucket/my%20file.jpg (works correctly)

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.

1 participant