payloadcms / payloadcms/payload
Upload with filename with trailing space is broken using GCS client uploads
@paulpopus is already working on this.
Since Jan 27, 2026.
- Dominant language
- TypeScript
- Stars
- 44.8k
- Forks
- 4.2k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 53
Description
Describe the Bug
sanitize-filename library is removing trailing spaces in filename, but if using clientUploads - google cloud storage receives original filename, resulting in broken upload .
Cliend uploads have some other bugs too (like double-uploading and server performance issues with client uploads) #14768
In my case, i generate direct link to GCS to bypass traffic from my server , directly to GCS , but i can't do that properly, because beforechange hook receives already sanitized filename.
Payload api doesn't work too (404)
Link to the code that reproduces this issue
Reproduction Steps
Prepeare file with space in the end
Upload it (with clientUploads:true)
Already admin panel having some issues
When saving, we have sanitized filename in admin panel
But file saved in GCS have original filename,which results in inaccessible file
And 404 on API
Which area(s) are affected?
plugin: storage-*
Environment Info
Binaries:
Node: 22.16.0
npm: 10.9.2
Yarn: N/A
pnpm: 10.22.0
Relevant Packages:
payload: 3.69.0
next: 15.4.10
@payloadcms/db-mongodb: 3.69.0
@payloadcms/graphql: 3.69.0
@payloadcms/live-preview: 3.69.0
@payloadcms/live-preview-react: 3.69.0
@payloadcms/next/utilities: 3.69.0
@payloadcms/plugin-cloud-storage: 3.69.0
@payloadcms/plugin-nested-docs: 3.69.0
@payloadcms/richtext-lexical: 3.69.0
@payloadcms/sdk: 3.69.0
@payloadcms/storage-gcs: 3.69.0
@payloadcms/translations: 3.69.0
@payloadcms/ui/shared: 3.69.0
react: 19.2.1
react-dom: 19.2.1
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:40 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6000
Available memory (MB): 16384
Available CPU cores: 10
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.