gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

File Block: Cannot Embed PDFs with Query Params

Open MichaelCastelbuono opened this issue 1 year ago • 1 comments

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

  1. Install an s3-like plugin such as WP Offload Media
  2. Upload PDF to media catalog
  3. Change the privacy setting from public to private
  4. Edit page and add a file block referencing the file
  5. 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

MichaelCastelbuono avatar Jul 25 '25 12:07 MichaelCastelbuono

I can reproduce the issue. I’ll start working on a fix shortly

BugReportOnWeb avatar Jul 25 '25 14:07 BugReportOnWeb