You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Filename not validated when calling IFolder->newFile() #47563
With the new IFilenameValidator implementation I would expect IFolder->newFile() to throw an error if passed file name is invalid. But it seems like that's not the case. newFile() still returns a File object and only further operation on this object fail. I guess there's a bug somewhere.
I would have expected server functions to do the validation when a file gets created.
Yes normally agree, but those functions also can be used for app data, which does not have those limitations.
So no validation, thats why we have the public interface \OCP\Files\IFilenameValidator
It looks like we already validate oc_filecache.path (4000), but not oc_filecache.name (250). Since appdata is also tracked in oc_filecache, I’d suggest reopening this issue and ensuring that newFile / the FileApi at least validates whether records with such information (e.g. names longer than 250) can actually be written.
Activity
susnux commentedon Aug 28, 2024
This is expected behavior.
You need to check the validity before creating.
It is only checked in webdav. The reason is that we use that api also for internal things that break with that validation (setup, appdata, updater).
So all user facing files should be validated but the IFolder and FilesView api are also used for private stuff
mejo- commentedon Sep 4, 2024
Ok, thanks for clarification. I would have expected server functions to do the validation when a file gets created. Let's close this then.
susnux commentedon Sep 4, 2024
Yes normally agree, but those functions also can be used for app data, which does not have those limitations.
So no validation, thats why we have the public interface
\OCP\Files\IFilenameValidatorkesselb commentedon Sep 25, 2025
It looks like we already validate
oc_filecache.path(4000), but notoc_filecache.name(250). Since appdata is also tracked inoc_filecache, I’d suggest reopening this issue and ensuring thatnewFile/ the FileApi at least validates whether records with such information (e.g. names longer than 250) can actually be written.