Skip to content

File Block: Cannot Embed PDFs with Query Params #70908

@MichaelCastelbuono

Description

@MichaelCastelbuono

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.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Labels

[Block] FileAffects the File Block[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions