Issue #1112 open

The reference to the same file is interpreted as a duplicate

created an issue

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).

Comments (5)

  1. Tawez reporter
    • changed status to open

    Proposed solution works for downloads, but doesn't work for images.

    I think this would be a better fix:

    def relfn2path(self, filename, docname=None):
        # ...
            return path.normpath(rel_fn), path.normpath(path.join(self.srcdir, rel_fn))
        except UnicodeDecodeError:
            return path.normpath(rel_fn), path.normpath(path.join(self.srcdir, enc_rel_fn))
  2. Log in to comment