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
The reference to the same file is interpreted as a duplicate #1112
Labels
Milestone
Comments
From Georg Brandl on 2013-03-30 11:44:59+00:00 Thanks for the report! |
From Tawez on 2013-04-02 12:37:00+00:00 Proposed solution works for downloads, I think this would be a better fix:
|
tk0miya
added a commit
to tk0miya/sphinx
that referenced
this issue
Jan 17, 2021
`:download:` role creates duplicated copies when the document contains two or more the role for the same file, but in different form. It considers two paths are different when one contains relative path like `path/to/../file.dat`. Internally, `env.relfn2path()` does not normalize the given path in relative form. As a result, download role can't detect the same paths are given. This adds `os.path.normpath()` to `env.relfn2path()` to normalize the path.
tk0miya
added a commit
to tk0miya/sphinx
that referenced
this issue
Jan 17, 2021
`:download:` role creates duplicated copies when the document contains two or more the role for the same file, but in different form. It considers two paths are different when one contains relative path like `path/to/../file.dat`. Internally, `env.relfn2path()` does not normalize the given path in relative form. As a result, download role can't detect the same paths are given. This adds `os.path.normpath()` to `env.relfn2path()` to normalize the path.
tk0miya
added a commit
that referenced
this issue
Jan 18, 2021
Fix #1112: download role creates duplicated copies
This is a bad fix. Breaks Windows builds. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Tested on Windows 7 64bit machine, Python 2.7.3, Sphinx 1.1.3
If there is reference in various ways to the same resource, it is interpreted as different file with duplicate name.
If there is a files structure as follows:
And we have the following code in index.rst:
Then during the build of html output we will have three files (while only one is expected):
The same issue is with figure directive.
In attachment there is a simple Sphinx project just to illustrate the issue.
IMO the problem is because all paths in Sphinx code are not normalized (os.path.normpath() function is missing).
The text was updated successfully, but these errors were encountered: