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

Remote image URIs without filename break HTML builds in 1.6.2 #3860

Closed
jantman opened this issue Jun 11, 2017 · 5 comments
Closed

Remote image URIs without filename break HTML builds in 1.6.2 #3860

jantman opened this issue Jun 11, 2017 · 5 comments
Assignees
Labels
Milestone

Comments

@jantman
Copy link

jantman commented Jun 11, 2017

Subject: Remote image URIs without filename break HTML builds in 1.6.2

Problem

  • Remote image URIs that lack a filename, such as readthedocs.org status badges which are URIs of the form https://readthedocs.org/projects/PROJECT-NAME/badge/?version=latest (note there is no explicit filename here), break the HTML builder.

Procedure to reproduce the problem

Attempt building a project which includes an image like the above in a file, such as README.rst, using Sphinx 1.6.2. i.e.:

.. image:: https://readthedocs.org/projects/awslimitchecker/badge/?version=latest
   :target: https://readthedocs.org/projects/awslimitchecker/?badge=latest
   :alt: sphinx documentation for latest release

https://readthedocs.org/projects/awslimitchecker/badge/?version=latest actually redirects to https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat - the URL checks the status of the docs build for the specified version, and redirects to an appropriate shields.io badge.

Build with:

sphinx-build -a -n -W -b linkcheck docs/source docs/build/html

Error logs / results

Warning, treated as error:
Could not fetch remote image: https://readthedocs.org/projects/awslimitchecker/badge/?version=latest [[Errno 21] Is a directory: u'/home/jantman/GIT/awslimitchecker/docs/build/html/.doctrees/images/https/readthedocs.org/projects/awslimitchecker/badge//version=latest/']

From what I can tell, the problem seems to be in sphinx.transforms.post_transforms.images.ImageDownloader.handle as introduced in #3589, as the local paths that it generates do not work for images without a filename (basename) in the URI.

Expected results

Expected these images to download correctly without a problem, as they did under 1.5.5

Reproducible project / your project

Environment info

  • OS: Linux (Arch, or whatever TravisCI and readthedocs.org run)
  • Python version: 2.7.13
  • Sphinx version: 1.6.2
jantman added a commit to jantman/awslimitchecker that referenced this issue Jun 11, 2017
jantman added a commit to jantman/versionfinder that referenced this issue Jun 15, 2017
@jfbu
Copy link
Contributor

jfbu commented Jun 19, 2017

I can not reproduce your problem with minimal index.rst containing only

Welcome to FOO's documentation!
===============================

.. image:: https://readthedocs.org/projects/awslimitchecker/badge/?version=latest
   :target: https://readthedocs.org/projects/awslimitchecker/?badge=latest
   :alt: sphinx documentation for latest release

and

# Sphinx version: 1.6.2
# Python version: 2.7.13 (CPython)
# Docutils version: 0.13.1 release
# Jinja2 version: 2.9.6

on mac os. Also tested with Python 3.5.3.

@jfbu
Copy link
Contributor

jfbu commented Jun 19, 2017

apologies, yes indeed using the sphinx-build

$ sphinx-build -a -n -W -b linkcheck . _build/html

as you said. By the way on Sphinx 1.5.6, the same Warning is issued without even activating linkcheck.

@jfbu
Copy link
Contributor

jfbu commented Jun 19, 2017

Well, sorry again, there is the problem even without linkcheck.

Error: No error with 1.6.2, but error with 1.5.6:

$ sphinx-build -a -n -W  . _build/html

No Error:

$ make clean html O="-a -n -W"

Again Error:

$ make clean html O="-b linkcheck -W"

Or simply one gets the warning via

 $ make clean linkcheck

Looks as if linkcheck needs update

@jfbu jfbu added the type:bug label Jun 19, 2017
@jfbu jfbu added this to the 1.6.3 milestone Jun 19, 2017
@jantman
Copy link
Author

jantman commented Jun 19, 2017

Ok, thank you. Apologies for not posting a gist or repo, or some quicker way for you to reproduce the issue.

@tk0miya tk0miya self-assigned this Jun 25, 2017
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jun 25, 2017
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jun 25, 2017
jantman added a commit to jantman/webhook2lambda2sqs that referenced this issue Jun 25, 2017
@tk0miya
Copy link
Member

tk0miya commented Jul 1, 2017

Fixed by #3890.
Thank you for reporting!

@tk0miya tk0miya closed this as completed Jul 1, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants