gutenberg
gutenberg copied to clipboard
File Block: Cannot Embed PDFs with Query Params
Description
Because of the current logic in the file block a PDF url must end with .pdf to be considered a PDF. Thus, if a url has query params it is not considered a PDF and you lose the ability to embed. This is particularly common when you are using a plugin that uses signed urls for documents stored in s3-like storage.
Step-by-step reproduction instructions
- Install an s3-like plugin such as WP Offload Media
- Upload PDF to media catalog
- Change the privacy setting from public to private
- Edit page and add a file block referencing the file
- Because the url has query params no embed is possible
Screenshots, screen recording, code snippet
No response
Environment info
- WordPress version 6.8.2.
Please confirm that you have searched existing issues in the repo.
- [x] Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- [x] Yes
Please confirm which theme type you used for testing.
- [x] Block
- [ ] Classic
- [ ] Hybrid (e.g. classic with theme.json)
- [ ] Not sure
I can reproduce the issue. I’ll start working on a fix shortly