Skip to content
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

formats.pdf.buttons.download.href produces one too many ../ #60

Open
nbanyan opened this issue Dec 13, 2024 · 2 comments
Open

formats.pdf.buttons.download.href produces one too many ../ #60

nbanyan opened this issue Dec 13, 2024 · 2 comments

Comments

@nbanyan
Copy link

nbanyan commented Dec 13, 2024

As identified in the conversation for issue #59, formats.pdf.buttons.download.href results in one too many parent directory references.

return os.path.relpath(page.formats['pdf']['url'], page.url)

os.path.relpath assumes the source argument is a directory, so when it receives a file path the file's name is also treated like a directory.

This would be resolved with the following:

return os.path.relpath(page.formats['pdf']['url'], os.path.dirname(page.url))
@niclasheinz
Copy link

This behaviour only occurs when the ‘offline’ plugin is activated.

@nbanyan
Copy link
Author

nbanyan commented Dec 17, 2024

When I investigated and tested this with my project, I found identical behavior with this href generation regardless of whether offline was enabled.
Seems like this is the same issue reported in #44. However use_directory_urls doesn't change this behavior for me either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants