Display large PDF files in file preview

I managed to solve the issue. Here is the full story:

  • The S3 signed URLs do not mention the extension of the file type (only the object id)
  • The file preview widget choose the HTML tag for the embedded content depending on the filename.
  • By default, the file preview widget would choose the <img> tag
  • Firefox and Chrome block the content of the file when the browser try to display a PDF in an <img>tag. (ERR_BLOCKED_BY_ORB for Chrome and NS_BINDING_ABORTED for Firefox)

I mitigated this behavior by using ActiveStorage redirect mode for serving files instead of a direct link to S3.

This would be useful to mention in the documentation that the extension of the file in the URL has to match the file type.