NextCloud reported that it could not sync some files because they had trailing spaces. I looked at the specific files and while they didn’t have trailing spaces, they did have a single leading space. Obviously I can fix that but it’s unclear to me why a space should prevent NextCloud from syncing.
I think there is a bug, but it took me a verrrry long time to find the solution which is not good today.
Note that version 3.3.6 did not find issues with trailing spaces and it is the 220.127.116.11version that carries them over (like version 3.4.2)
To better understand my description below :
I work with an HP file server which the client workstations access via a webdav access, so I will call “HP server” the source directory to be synchronized.
the initials “NC” (for NextCloud) correspond to the synchronized local directory.
The remote Nextcloud server corresponds to the web directory with which the local NC directory synchronizes.
the synchronization is done from a client station of my company.
Here is the description of the problems and the outline of solutions when we have a directory with a trailing space and a file with a trailing space :
no synchronization between the HP server and the synchronized directory: an error is detected on the directory of the local HP server to be synchronized which contains a space. In the synchronized directory NC we then find the sub-directory with space (full directory, containing files) and another sub-directory created by NC, of the same name but without space, but empty of files. The fact that directories with trailing spaces are full of its original files is not systematic. Sometimes they are empty and removing the traling space has the effect of showing the contents of the space directory, sometimes it doesn’t.
If there is a directory with trailing spaces, move the contents of the directory to the directory without space and delete both sides of the directory with space. Be careful, the deletion is not always registered with the remote Nexcloud server which sometimes recreates them all. It takes up to 3 or 4 passes for the directories to be permanently deleted.
Note that removing the space from the directory or renaming the directory differently does not solve the problem because synchronization is blocked.
I then delete the space of the problematic directory on both sides, I create a copy of this directory on both sides (only one side is not enough, no synchronization). Synchronization is done.
at this time, NC recreated the original directory with a trailing space and left it empty of any content on the server side and created nothing on the synchronized folder side.
then, I delete the directory containing a trailing space in the server, and the copied directory too: the synchro works again without error. Note that deleting the directory copied to NC does not sync with the HP server, you need to delete both sides manually to allow normal operation.
For a renaming: it creates a new directory without deleting the old one as if there were no rights to do so, while the rights have been checked.
Deleting files with spaces is easier:
on the HP server, NC creates a file without the space and keeps the file with trailing space (the file with space was created under the HP server). On the NC side, there is no file with trailing space, but only the same file without space.
deleting the file with trailing space is not enough to remove the HP server side sync error, you need to force sync.
If forcing synchronization does not work (it happens), you must create a new directory with an almost identical name (or copy directory) and move the contents of the old directory to the new one and then delete the copied directory on NC and on the HP server (deleting on one of the two sides only, especially on the HP server, it has no synchronization effect with NC).
The easiest way when you have a directory with a space is to remove the space from the file or directory, and copy (or move) the contents into a new created directory instead.
The easiest way when you have a file with a space is to delete the file with space from the synchronized local directory and force the synchronization because NC does not delete the file with space in this directory.
In any case, what is annoying is that each new synchronization detects a new batch of files and directories with spaces and that you have to start over each time.
Some errors are very difficult to correct:
after doing the manipulations above, some errors persist in the control panel, without being able to have a complete display to understand which directory is concerned or without having the possibility of having easy access to a history on the https server: error 404, server replied “423 lock to delete https…” in general, a directory is designated as problematic without knowing why there is a problem. When it is possible to click to return to the web interface, the link is not good and we systematically arrive at the home page. The “view activity” link displays an empty window…
this obliges to recreate different directories in the directory tree and to copy the contents of the directory with problems in that which one has just created… when one can identify the problem.
Same problem on NC 23.0.3 (dockerized).
Data downloaded from Google drive on a fresh install of NextCloud. Works fine on the previous version of NC but since the 23.0.3 upgrade, all folders with trailing space stop all the sync process with all mac clients.
Not really sure what you are doing, but I have 0 files and folders with trailing spaces.
If you want to fix it, and a lot of files and folders are involved, you might want to look into scripts. Even Windows with powershell should have some possibilities available right now.
I have the same problem with NC client 3.5.1 Windows.
“filename contains leading spaces”.
We have many files, especially outlook mails (.msg), which have leading spaces.
So nextcloud is useless for us.
Is there an update in plan that will solve the problem?
Now imaging the client using leading or trailing spaces, perhaps they will be renamed by Windows (should this then synced back to everyone else), what if the file then can’t be renamed or deleted on the Windows client? And if Microsoft discourages using this, we shouldn’t do it.
Why outlook is doing this? I didn’t find a reference and I don’t use it to know. But as a Microsoft customer, you can perhaps ask them. Can’t you use a different name to save it or remove the trailing spaces?