The reference to the same file is interpreted as a duplicate
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:
[source]/ document/ downloads/archive.zip index.rst
And we have the following code in index.rst:
:download:`downloads/archive.zip` :download:`/document/downloads/archive.zip` :download:`../document/downloads/archive.zip`
Then during the build of html output we will have three files (while only one is expected):
[build]/ _downloads/ archive.zip archive1.zip archive2.zip
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).