mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
delete macOS specific files
This commit is contained in:
parent
f8afbae2cd
commit
93a79be1e2
@ -333,6 +333,12 @@ class Consumer(LoggingMixin):
|
|||||||
self.log("debug", "Deleting file {}".format(self.path))
|
self.log("debug", "Deleting file {}".format(self.path))
|
||||||
os.unlink(self.path)
|
os.unlink(self.path)
|
||||||
|
|
||||||
|
# https://github.com/jonaswinkler/paperless-ng/discussions/1037
|
||||||
|
shadow_file = os.path.join(os.path.dirname(self.path), "._" + os.path.basename(self.path))
|
||||||
|
if os.path.isfile(shadow_file):
|
||||||
|
self.log("debug", "Deleting file {}".format(shadow_file))
|
||||||
|
os.unlink(shadow_file)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._fail(
|
self._fail(
|
||||||
str(e),
|
str(e),
|
||||||
|
@ -317,6 +317,25 @@ class TestConsumer(DirectoriesMixin, TestCase):
|
|||||||
|
|
||||||
self._assert_first_last_send_progress()
|
self._assert_first_last_send_progress()
|
||||||
|
|
||||||
|
@override_settings(PAPERLESS_FILENAME_FORMAT=None)
|
||||||
|
def testDeleteMacFiles(self):
|
||||||
|
# https://github.com/jonaswinkler/paperless-ng/discussions/1037
|
||||||
|
|
||||||
|
filename = self.get_test_file()
|
||||||
|
shadowFile = os.path.join(os.path.dirname(filename), "._" + os.path.basename(filename))
|
||||||
|
|
||||||
|
shutil.copy(filename, shadowFile)
|
||||||
|
|
||||||
|
document = self.consumer.try_consume_file(filename)
|
||||||
|
|
||||||
|
self.assertTrue(os.path.isfile(
|
||||||
|
document.source_path
|
||||||
|
))
|
||||||
|
|
||||||
|
self.assertFalse(os.path.isfile(shadowFile))
|
||||||
|
self.assertFalse(os.path.isfile(filename))
|
||||||
|
|
||||||
|
|
||||||
def testOverrideFilename(self):
|
def testOverrideFilename(self):
|
||||||
filename = self.get_test_file()
|
filename = self.get_test_file()
|
||||||
override_filename = "Statement for November.pdf"
|
override_filename = "Statement for November.pdf"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user