Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix-workspace-find-undo-download'
Browse files Browse the repository at this point in the history
  • Loading branch information
kba committed Aug 13, 2024
2 parents ea2e06d + 54913fb commit 949925f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/ocrd/cli/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,19 +467,18 @@ def workspace_find(ctx, file_grp, mimetype, page_id, file_id, output_field, incl
include_fileGrp=include_fileGrp,
exclude_fileGrp=exclude_fileGrp,
):
ret_entry = [f.ID if field == 'pageId' else str(getattr(f, field)) or '' for field in output_field]
if download and not f.local_filename:
workspace.download_file(f)
modified_mets = True
if wait:
time.sleep(wait)
if undo_download and f.url and f.local_filename:
ret_entry = [f'Removed local_filename {f.local_filename}']
f.local_filename = None
modified_mets = True
if not keep_files:
ctx.log.debug("rm %s [cwd=%s]", f.local_filename, workspace.directory)
unlink(f.local_filename)
ret_entry = [f.ID if field == 'pageId' else str(getattr(f, field)) or '' for field in output_field]
ret.append(ret_entry)
if modified_mets:
workspace.save_mets()
Expand Down

0 comments on commit 949925f

Please sign in to comment.