Server replied: Bad request. (Filename Problem?)

Hi, i get a bad request error on my hosted Nextcloud (via Hetzner).

  • Nextcloud Server version (e.g., 29.x.x):
    • 29.0.9
  • Operating system and version (e.g., Ubuntu 24.04):
    • Win11 Pro 23H2

As my Instance is hostet, i’m not able to update to a newer version (this is done by hetzner)

I have a maybe to long Filename and it’s there not possible to sync it to my nextcloud. After a backup of my E-Mail software i get this Error:

Zusammenfassung

Error transferring https://storage.XXX.de/remote.php/
dav/files/Hewal/Privat/Datensicherung/emClient/eMails/Alle
Mails/hewal@XXX.de/Gesendete Elemente/2024-04-08
15-21-31
unsubscribe_SqIBOHgkTLunvMuTILmgsxcYd0xDuWZmBKtD7hoV7e

  • server replied: Bad Request

i have tried to delete and rename this file on Windows, but it’s seems to be blocked from the nextcloud Client. After try to delete / change name there is no error, but the file has same name (by trying to change name) or is still there (after trying do delete).

Is there any solution?

There are some characters that are not supported in Windows (Windows illegal filename characters - can't find the github bug report) but I don’t see any of them in your URL. And the path should not be longer than 255 characters (File names too long - issue with NTFS filename compliance), including folders. But it is not the case either.

If the client blocks it, why do you get a bad server request (= the client is trying to upload)?

I was able to sync such a file (between date and hour I put a space):

It’s NC 30.

Hi, you checked only the filename. i think the whole path is too long:

"Privat/Datensicherung/emClient/eMails/Alle Mails/hewal@xx-xxxxxxxx.de/Gesendete Elemente//2024-04-08 15-21-31 unsubscribe_SqIBOHgkTLunvMuTILmgsxcYd0xDuWZmBKtD7hoV7eU ~_ eyAicmNwdF90byl6ICJoZXdhbEBzZy1kaWdpdGFscy5kZSlsICJ0ZW5hbnRfaWQiOiAic3BjliwglmN1c3RvbWVyX2lkljogljlxODE3MSlslCJtZXNzYWdIX2lkljogljY2MTA3ZDA2MTQ2NjU4ZTE1MTViliwgInN1YmFjY291bn.eml

The Problem is, i can’t edit the filename and i can’t delete the file… nothing happens (for both ways).

i had the same issue with the inbox backup. there i deletet the whole parent folder and the problem was solved.

But i think this is not the way it should work, because other files maybe are needed, therefore deleting all files is not such good solution :slight_smile:

Any idea how to fix it?

I cannot even create file with such a name (on Win10, NTFS file system), even with a script I get this error:
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\DATA\\Nextcloud\\test_upload\\hewal@XXX.de\\test.txt' -> 'C:\\DATA\\Nextcloud\\test_upload\\hewal@XXX.de\\2024-04-08 15-21-31 unsubscribe_SqIBOHgkTLunvMuTILmgsxcYd0xDuWZmBKtD7hoV7eU ~_ eyAicmNwdF90byl6ICJoZXdhbEBzZy1kaWdpdGFscy5kZSlsICJ0ZW5hbnRfaWQiOiAic3BjliwglmN1c3RvbWVyX2lkljogljlxODE3MSlslCJtZXNzYWdIX2lkljogljY2MTA3ZDA2MTQ2NjU4ZTE1MTViliwgInN1YmFjY291bn.eml'

So I cannot test how to do that. If you put the file into a different folder (outside Nextcloud), you can rename it?

no, i was not able to do anything with this file in the gui. ChatGPT gave me the tip to delete it with cmd, this worked. Now the error is away.

ChatGPT gives me a Registry Key to enable long Pathes in Windows, too. i added it (after deleting) to prevent such errors in the future.

Are there any restriction about patch length in Nextcloud?

For characters in filenames they have something in place, for the path length I am not sure, but it seems so, there are a few items in the bug tracker:

I let you go through this, if there is a way to go around that. It must be more annoying for users on OS that don’t have this restricition.

And your backup, there is no way they use smaller file names? Just thinking, if you have a backup and you restore on a different computer that does not have the registry changes, this is always a bit complicated.

No unforntunatly there is no way to make the mails shorter. It’s a strange thing, because windows can handle it without the registry setting (restore does work).