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

resolver: when downloading a file-url fall back to url for basename, … #165

Merged
merged 3 commits into from
Aug 22, 2018

Conversation

kba
Copy link
Member

@kba kba commented Aug 20, 2018

When downloading, to a known directory, a file:// URL referencing a path within that directory, the resolver assumed the URL to be opaque and created a safe filename version of that URL. Which adds up to exponentially long filenames when repeated.

This PR catches that case (basename not set, file-URL pointing to the workspace directory) and should result in a no-op if that file already exists.

@kba kba requested review from wrznr and cneud August 20, 2018 17:09
ocrd/resolver.py Outdated
@@ -119,6 +119,8 @@ def download_to_directory(self, directory, url, basename=None, overwrite=False,
"""
Download a file to the workspace.

Early Shortcut: If iit's a file-URL and already in the directory, keep it there.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "If it's a file-URL"

@kba kba merged commit ea89eaf into OCR-D:master Aug 22, 2018
@kba kba deleted the fix-excessive-copying branch August 28, 2018 12:19
bertsky pushed a commit to bertsky/core that referenced this pull request Apr 26, 2023
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

Successfully merging this pull request may close these issues.

2 participants