mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Do not use query components in URLs for assets in EPUB rendering (#11766)
Signed-off-by: David Runge <dave@sleepmap.de> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
parent
d69d19103f
commit
a8f35bb463
@ -70,6 +70,8 @@ Bugs fixed
|
||||
Patch by James Addison.
|
||||
* #11886: Print the Jinja2 template path chain in ``TemplateNotFound`` exceptions.
|
||||
Patch by Colin Marquardt.
|
||||
* #11598: Do not use query components in URLs for assets in EPUB rendering.
|
||||
Patch by David Runge.
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
@ -1051,8 +1051,10 @@ class StandaloneHTMLBuilder(Builder):
|
||||
for key, value in css.attributes.items()
|
||||
if value is not None]
|
||||
uri = pathto(os.fspath(css.filename), resource=True)
|
||||
if checksum := _file_checksum(outdir, css.filename):
|
||||
uri += f'?v={checksum}'
|
||||
# the EPUB format does not allow the use of query components
|
||||
if self.name != 'epub':
|
||||
if checksum := _file_checksum(outdir, css.filename):
|
||||
uri += f'?v={checksum}'
|
||||
return f'<link {" ".join(sorted(attrs))} href="{uri}" />'
|
||||
|
||||
ctx['css_tag'] = css_tag
|
||||
@ -1079,8 +1081,10 @@ class StandaloneHTMLBuilder(Builder):
|
||||
# https://docs.mathjax.org/en/v2.7-latest/configuration.html#considerations-for-using-combined-configuration-files
|
||||
# https://github.com/sphinx-doc/sphinx/issues/11658
|
||||
pass
|
||||
elif checksum := _file_checksum(outdir, js.filename):
|
||||
uri += f'?v={checksum}'
|
||||
# the EPUB format does not allow the use of query components
|
||||
elif self.name != 'epub':
|
||||
if checksum := _file_checksum(outdir, js.filename):
|
||||
uri += f'?v={checksum}'
|
||||
if attrs:
|
||||
return f'<script {" ".join(sorted(attrs))} src="{uri}"></script>'
|
||||
return f'<script src="{uri}"></script>'
|
||||
|
Loading…
Reference in New Issue
Block a user