-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Images aren't save with an extension corresponding to the MIME type #13190
Comments
Only to mention that LaTeX does not require an explicit file extension, it will try (when building PDF from LaTEX source file) various extensions until a file is found. However in your MWE indeed the Note that generally speaking it is to be expected that it is not easy for builders such as LaTeX to handle sources which contain HTML specific mark-up and conventions. A simpler example drops With .. image:: https://img.shields.io/badge/doc-CC--BY%204.0-green input, the HTML will look like this <img alt="https://img.shields.io/badge/doc-CC--BY%204.0-green" src="https://img.shields.io/badge/doc-CC--BY%204.0-green" /> so Trying
and creates a LATEX mark-up like this \noindent\sphinxincludegraphics{{/path/to/sphinxtests/13190_image_filenames/_build/doctrees/images/c00128cef661b557f379b5ecea39df4b8203ab34/doc-CC--BY%204}.0-green} which does interpret The warning is misleading because the distant image file was indeed fetched and stored at the indicated location. The warning seems to say that only an svg extension was looked for, it appears the existing |
Your judgement isn't fully correct.
I've added the generated LaTeX code to the bug description. As an explanation for shields.io, they use 2 different subdomains:
|
Please avoid saying that comments are "not fully correct" when you are referring to your own interpretation of what I wrote, if you want to bear a by now small chance that I devote some of my unpaid time to your problems with Sphinx. It is not latex which does the act of including an image file into a produced PDF but the pdftex engine itself of course which is producing that PDF file. The binary Besides if I try to execute on the macOS command line |
Sorry, but I don't think you're the only developer spending unpaid time. So please, let's come back to the problem, which is not saving downloaded files according to the MIME type. The MIME type is present in the HTTP response to the Python code within the download routine. The presented problem isn't related to LaTeX. |
Very well. I will thus leave to others the task of reviewing PRs solving this. |
Describe the bug
When referencing a shield from shields.io, the shield URL has no dedicated extension like
.png
. Such a behavior is allowed. That's also why HTTP uses MIME types to identify the transmitted content types such asimage/png
.Example URL: https://img.shields.io/badge/doc-CC--BY%204.0-green?longCache=true&style=flat-square&logo=CreativeCommons&logoColor=fff
Behavior of Sphinx:
doc-CC--BY%204.0-green
with file extension*.0-green
.%20
isn't rewritten to avoid problems in LaTeX (comment sign).%20 is not escaped in image file names/URLs for LaTeX #13189 has been reported for this issue.
\sphinxincludegraphics[height=22\sphinxpxdimen]{{doc-CC--BY%2041}.0-green}
.I'm not sure about the Sphinx specific includegraphics macro, but usually, LaTeX should have a look at the file extension (file type) to decide for further file processing.
How to Reproduce
Example code:
Output:
Generated LaTeX Code:
Expected behavior:
Current filename:
doc-CC--BY%204.0-green
Corrected filename:
doc-CC--BY%204.0-green.png
Environment Information
Sphinx extensions
Additional context
LaTeX environment: MikTeX (all updated)
LaTeX processor: xelatex
This error happens when the LaTeX code is generated. No influence by the LaTeX system itself.
The text was updated successfully, but these errors were encountered: