Skip to content

Commit

Permalink
upload: use copy without metadata if the file cannot be renamed
Browse files Browse the repository at this point in the history
... to transfer the upload to its target directory.  For some reason, a
plain shutil.move call would fail on the OSH production hub with SELinux
enabled with a Permission denied error due to some relabelling problems.
However, copying without metadata works fine and it should not introduce
any regressions.

Related: openscanhub/openscanhub#180
  • Loading branch information
lzaoral committed Dec 12, 2023
1 parent 308ea96 commit 2d7641a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kobo/django/upload/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def file_upload(request):
if not os.path.isdir(upload.target_dir):
os.makedirs(upload.target_dir)

shutil.move(tmp_file_name, upload.target_dir)
shutil.move(tmp_file_name, upload.target_dir, copy_function=shutil.copy)
shutil.rmtree(tmp_dir)

upload.state = UPLOAD_STATES["FINISHED"]
Expand Down

0 comments on commit 2d7641a

Please sign in to comment.