diff --git a/LICENSE b/LICENSE index 3a099ae..0d849d1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ BSD 3-Clause License Copyright (c) 2018, Jeremy Cohen, Imperial College London + 2023, Equinor ASA All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/django_drf_filepond/api.py b/django_drf_filepond/api.py index dd6dfd3..c096312 100644 --- a/django_drf_filepond/api.py +++ b/django_drf_filepond/api.py @@ -164,7 +164,7 @@ def _store_upload_local(destination_file_path, destination_file_name, try: if not os.path.exists(target_dir): os.makedirs(target_dir) - shutil.copy2(temp_upload.get_file_path(), target_file_path) + shutil.move(temp_upload.get_file_path(), target_file_path) su.save() temp_upload.delete() except IOError as e: diff --git a/tests/test_api.py b/tests/test_api.py index af801f2..9e77011 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -335,12 +335,12 @@ def test_store_upload_local_direct_file_exists(self): def test_store_upload_local_copy_to_store_fails(self): tu = TemporaryUpload.objects.get(upload_id=self.upload_id) - with patch('shutil.copy2') as copy2_patch: + with patch('shutil.move') as move_patch: with patch('os.path.exists') as exists_patch: with patch('os.path.isdir') as isdir_patch: exists_patch.side_effect = [True, False, True] isdir_patch.return_value = True - copy2_patch.side_effect = IOError( + move_patch.side_effect = IOError( 'Error moving temporary file to permanent storage ' 'location') with self.assertRaisesMessage(