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

Do not use query components in URLs for assets in EPUB rendering #11766

Merged
merged 4 commits into from Jan 18, 2024

Conversation

dvzrv
Copy link
Contributor

@dvzrv dvzrv commented Nov 23, 2023

Subject: Do not use query components in URLs for assets in EPUB rendering

Feature or Bugfix

  • Bugfix

Purpose

If the EPUB builder is detected, do not add checksums in a query component to the URL of css and js assets.

Detail

The XHTML in EPUBs does not allow the use of query components in relative URLs.
The checksumming of assets, introduced in
ae20669 unconditionally adds a query component for the checksum, which breaks rendering on many enduser devices (tested on e.g. Kindle Paperwhite 3, Kobo Aura H2O Edition 2).

Relates

Fixes #11598

If the EPUB builder is detected, do not add checksums in a query
component to the URL of css and js assets.

The XHTML in EPUBs does not allow the use of query components in
relative URLs.
The checksumming of assets, introduced in
ae20669 unconditionally adds a query
component for the checksum, which breaks rendering on many enduser
devices (tested on e.g. Kindle Paperwhite 3, Kobo Aura H2O Edition 2).

Fixes sphinx-doc#11598

Signed-off-by: David Runge <dave@sleepmap.de>
@dvzrv
Copy link
Contributor Author

dvzrv commented Nov 23, 2023

Hmm, I don't think the test failures for py312 and py313 are related to my change, or can they? 🤔

@AA-Turner
Copy link
Member

You could swap the order of the check for a small optimisation, so that the file is not needlessly hashed when using an epub builder.

A

@AA-Turner
Copy link
Member

Please may you also add a test

@AA-Turner AA-Turner merged commit a8f35bb into sphinx-doc:master Jan 18, 2024
21 of 22 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EPUB: Relative URL strings must not have a query component
2 participants