Skip to content

Conversation

@kesselb
Copy link
Collaborator

@kesselb kesselb commented Sep 25, 2025

Summary

Validate the filename when creating a file from template.

Steps to reproduce

  • Log in as alice
  • Open Files
  • Click "New" and "New text file"
  • Use the filename: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.md

Outcome

On most installations this leads to a NotPermittedException exception because the filename is too long for oc_filecache.name. However, on MySQL/MariaDB without strict mode, such a filename is not rejected but truncated.

Jonas and Ferdinand discussed OCP\Files\Folder.newFile not validating the filename in #47563. Would it make sense to add a similar check in assertPathLength to ensure it fits both oc_filecache.path and oc_filecache.name, given the technical limitation of 250 characters?

TODO

  • CI
  • Review

Checklist

@kesselb kesselb added this to the Nextcloud 33 milestone Sep 25, 2025
@kesselb kesselb requested a review from susnux September 25, 2025 13:04
@kesselb kesselb self-assigned this Sep 25, 2025
@kesselb kesselb requested a review from a team as a code owner September 25, 2025 13:04
@kesselb kesselb added the bug label Sep 25, 2025
@kesselb kesselb requested review from leftybournes and nfebe and removed request for a team September 25, 2025 13:04
@kesselb kesselb added the 3. to review Waiting for reviews label Sep 25, 2025
@kesselb kesselb requested a review from CarlSchwan September 25, 2025 13:04
@kesselb kesselb force-pushed the bug/noid/validate-filename-when-creating-file-from-template branch from f5a2c6f to 5c34ee7 Compare September 25, 2025 15:13
@kesselb
Copy link
Collaborator Author

kesselb commented Oct 7, 2025

/backport to stable32

@kesselb
Copy link
Collaborator Author

kesselb commented Oct 7, 2025

/backport to stable31

@kesselb
Copy link
Collaborator Author

kesselb commented Oct 7, 2025

/backport to stable30

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
@kesselb kesselb force-pushed the bug/noid/validate-filename-when-creating-file-from-template branch from 5c34ee7 to 6e04437 Compare October 23, 2025 23:05
@kesselb kesselb merged commit 1f9f41a into master Oct 24, 2025
205 of 216 checks passed
@kesselb kesselb deleted the bug/noid/validate-filename-when-creating-file-from-template branch October 24, 2025 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants