Skip to content

Commit

Permalink
Fix file move and remove in archiver tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkCalvert committed Feb 22, 2024
1 parent be5ffe3 commit 46812af
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
27 changes: 27 additions & 0 deletions ckan/patches/ckanext-archiver/01_copy_archive_resource.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
index 06a1758..08a3ba6 100644
--- a/ckanext/archiver/tasks.py
+++ b/ckanext/archiver/tasks.py
@@ -568,14 +568,14 @@ def archive_resource(context, resource, log, result=None, url_timeout=30):
except Exception:
file_name = "resource"

- # move the temp file to the resource's archival directory
- saved_file = os.path.join(archive_dir, file_name)
- shutil.move(result['saved_file'], saved_file)
- log.info('Going to do chmod: %s', saved_file)
try:
- os.chmod(saved_file, 0o644) # allow other users to read it
+ # move the temp file to the resource's archival directory
+ saved_file = os.path.join(archive_dir, file_name)
+ shutil.copy(result['saved_file'], saved_file)
+ log.info('File moved : %s', saved_file)
+ os.remove(result['saved_file'])
except Exception as e:
- log.error('chmod failed %s: %s', saved_file, e)
+ log.error("move the temp file to the resource's archival directory failed %s: %s", saved_file, e)
raise
log.info('Archived resource as: %s', saved_file)


~
~
13 changes: 0 additions & 13 deletions ckan/patches/ckanext-archiver/01_copy_function.patch

This file was deleted.

0 comments on commit 46812af

Please sign in to comment.