Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.xhtml file missing text/html mimetype, not loaded by HtmlArticleGalley plugin #10664

Closed
NateWr opened this issue Dec 9, 2024 · 4 comments
Closed
Milestone

Comments

@NateWr
Copy link
Contributor

NateWr commented Dec 9, 2024

Describe the bug
When a file with a .xhtml is uploaded, it is assigned the mimetype text/xml. As a result, it is not loaded by the HtmlArticleGalleyPlugin viewer.

To Reproduce
Steps to reproduce the behavior:

  1. Upload a .xhtml galley to a submission (example below)
  2. Publish the submission
  3. Click on the alley on the article landing page
  4. See that it downloads the file instead of showing it

What application are you using?
stable-3_3_0

Additional information
This is addressed in #5063, but it only applies to files named with a .html extension. When I added an exception to PKPString::getAmbiguousExtensionsMap() for xhtml, the mimetype text/html was assigned and the galley was displayed correctly.

Example XHTML File
GitHub won't let me upload it, so copy and save this as .xhtml.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Lorem ipsum dolor sit amet</title>
  </head>
  <body>
    <main>
      ...
    </main>
  </body>
</html>
NateWr added a commit to NateWr/pkp-lib that referenced this issue Dec 9, 2024
@NateWr
Copy link
Contributor Author

NateWr commented Dec 9, 2024

The following PR adds an exception for XHTML files to apply the text/html mimetype.

PR:
#10665 (stable-3_3_0)
#10681 (stable-3_4_0)
#10682 (main)

Tests:
pkp/ojs#4545 (stable-3_3_0)
pkp/ojs#4550 (stable-3_4_0)
pkp/ojs#4551 (main)

@asmecher
Copy link
Member

asmecher commented Dec 9, 2024

Looks good, thanks, @NateWr -- can you forward-port to stable-3_4_0 and main?

NateWr added a commit to NateWr/pkp-lib that referenced this issue Dec 11, 2024
NateWr added a commit to NateWr/pkp-lib that referenced this issue Dec 11, 2024
@NateWr
Copy link
Contributor Author

NateWr commented Dec 11, 2024

Thanks @asmecher, I've added PRs for all branches now.

@asmecher
Copy link
Member

All merged, thanks! (I'll take care of the submodules separately.)

@asmecher asmecher added this to the 3.3.0-21 milestone Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants