Understanding the file upload procedure

I’m on Nextcloud 18.0.3, where I’m currently trying to understand the following problem:
When uploading files (either through the WebUI or the Linux client), the progress bar always gets stuck on 100 % (“Processing files…”) for some time before the upload is completed. Watching the file system for this duration showed me that the file gets actually written twice, the first time to nextcloud-data-folder/user/uploads/web-file-upload-HASH, the second time to nextcloud-data-folder/user/files/filename.ocTransferId9DIGITID.part. This is unnecessary, since the two folders are already in the same filesystem. So should a regular mv not be enough to move the file in place?

My question is: How is the upload procedure designed to work? Is this a bug or a feature? I would really appreciate it if somebody could point me to the portion of the code that is in charge of this. (I wasn’t able to find it myself, I don’t know much about the project’s architecture.)

By the way, I am using Debian 10 and Apache, and the Nextcould data directory is located on a LUKS-encrypted ext4 filesystem. The temporary upload directory of PHP is also on this filesystem. In this directory, small files of a few MB appear in high frequency while uploading.

1 Like

Can reproduce on 22.0.0. I wonder what is going on too.