mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Make generated download links reproducible
Without this change the hexdigest generated in DownloadFiles.add_file() depends on source_dir, while just the path fragment relative to it is sufficient.
This commit is contained in:
parent
127d4db0d4
commit
6fc8873087
@ -137,7 +137,7 @@ class DownloadFileCollector(EnvironmentCollector):
|
||||
logger.warning(__('download file not readable: %s') % filename,
|
||||
location=node, type='download', subtype='not_readable')
|
||||
continue
|
||||
node['filename'] = app.env.dlfiles.add_file(app.env.docname, filename)
|
||||
node['filename'] = app.env.dlfiles.add_file(app.env.docname, rel_filename)
|
||||
|
||||
|
||||
def setup(app):
|
||||
|
@ -451,7 +451,7 @@ def test_html_download(app):
|
||||
@pytest.mark.sphinx('html', testroot='roles-download')
|
||||
def test_html_download_role(app, status, warning):
|
||||
app.build()
|
||||
digest = md5((app.srcdir / 'dummy.dat').encode()).hexdigest()
|
||||
digest = md5(b'dummy.dat').hexdigest()
|
||||
assert (app.outdir / '_downloads' / digest / 'dummy.dat').exists()
|
||||
|
||||
content = (app.outdir / 'index.html').text()
|
||||
|
Loading…
Reference in New Issue
Block a user