1. Georg Brandl
  2. sphinx

Commits

Georg Brandl  committed 61ce50c

Closes #1112: Avoid duplicate download files when referenced from documents in
different ways (absolute/relative).

  • Participants
  • Parent commits 9b68e77
  • Branches default

Comments (0)

Files changed (2)

File CHANGES

View file
 * #1126: Fix double-hyphen to en-dash conversion in wrong places such as
   command-line option names in LaTeX.
 * #1117: Handle .pyx files in sphinx-apidoc.
+* #1112: Avoid duplicate download files when referenced from documents in
+  different ways (absolute/relative).
 * #1111: Fix failure to find uppercase words in search when
   :confval:`html_search_language` is 'ja'. Thanks to Tomo Saito.
 * #1108: The text writer now correctly numbers enumerated lists with

File sphinx/environment.py

View file
                                                 base=None))
             rel_fn = path.join(docdir, filename)
         try:
-            return rel_fn, path.join(self.srcdir, rel_fn)
+            # the path.abspath() might seem redundant, but otherwise artifacts
+            # such as ".." will remain in the path
+            return rel_fn, path.abspath(path.join(self.srcdir, rel_fn))
         except UnicodeDecodeError:
             # the source directory is a bytestring with non-ASCII characters;
             # let's try to encode the rel_fn in the file system encoding
             enc_rel_fn = rel_fn.encode(sys.getfilesystemencoding())
-            return rel_fn, path.join(self.srcdir, enc_rel_fn)
+            return rel_fn, path.abspath(path.join(self.srcdir, enc_rel_fn))
 
     def find_files(self, config):
         """Find all source files in the source dir and put them in