mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
force flush on temp file during consumption
file.write() does not guarantee that a file handle contains anything without calling an accompanying file.flush() For typical files that are larger than the OS-file buffer, this is no problem For small files (e.g. 64 characters in a .TXT), this race condition leads to `inode/x-empty` because the file inode is created, but no content is written to it
This commit is contained in:
@@ -383,6 +383,7 @@ class PostDocumentView(APIView):
|
||||
dir=settings.SCRATCH_DIR,
|
||||
delete=False) as f:
|
||||
f.write(doc_data)
|
||||
f.flush()
|
||||
os.utime(f.name, times=(t, t))
|
||||
|
||||
async_task("documents.tasks.consume_file",
|
||||
|
Reference in New Issue
Block a user