Skip to content

Restrict the length of the resource name #772

Closed

Description

@v-scharf

Initial Checklist

  • I understand this is a bug report and questions should be posted in the Community Discussions
  • I searched issues and couldn’t find anything (or linked relevant results below)

Bug Description

related opencloud-eu/opencloud#953

Reproduction Steps

  1. Create a folder/file with long name length (more than 256bytes)

Expected Outcome

name is restricted

Actual Outcome

The name is not limited, which leads to various problems.

Activity

  1. added theissue type on May 30, 2025
  2. removed theissue type on May 30, 2025
  3. moved this from Qualification to No status in OpenCloud Team Boardon May 30, 2025
  4. kulmann commented on May 30, 2025

    @kulmann
    Member

    Do you know how many characters are allowed?

  5. v-scharf commented on May 30, 2025

    @v-scharf
    ContributorAuthor

    Do you know how many characters are allowed?

    server has problems sending more than 256 bytes.

    Latin: 1 character = 1 byte.
    Cyrillic: 1 character = 2 bytes.
    Arabic: 1 character = 2-3 bytes.
    Chinese: 1 character = 3 bytes.
    Emodj: 1 character = 4 bytes.

    63 characters will be guaranteed to work.

  6. self-assigned this
    on Jun 1, 2025
  7. kulmann commented on Jun 2, 2025

    @kulmann
    Member

    Do you know how many characters are allowed?

    server has problems sending more than 256 bytes.

    Latin: 1 character = 1 byte. Cyrillic: 1 character = 2 bytes. Arabic: 1 character = 2-3 bytes. Chinese: 1 character = 3 bytes. Emodj: 1 character = 4 bytes.

    63 characters will be guaranteed to work.

    Nice analysis, thank you! What do you think about space names then, should we limit those to 63 characters as well? Those are currently limited to 255 characters.

  8. v-scharf commented on Jun 2, 2025

    @v-scharf
    ContributorAuthor

    What do you think about space names then, should we limit those to 63 characters as well?

    yeah, good point. we should take care also about the space names

  9. takerukoushirou commented on Sep 13, 2025

    @takerukoushirou

    I understand that there is currently a server-side limitation of 256 bytes, but shouldn't the web client then try to limit filenames to 256 bytes? Since the update I constantly run into the issue that filenames during a rename are too long although I'm mostly using 1-byte characters. A limit of 63 characters is extremely restrictive for languages with 1-2 bytes per character.

    The actual byte length of a string could AFAIK be calculated using the TextEncoder API.

  10. AlexAndBear commented on Sep 13, 2025

    @AlexAndBear
    Member

    @takerukoushirou good point!

    @kulmann can we create a user story out of this for the upcoming sprint ? This can be implemented with ease since you centralized the resource name validation some weeks ago.

    The only issue I see with this approach is, that we can't expose a detailed error message e.G only x characters allowed, instead we are only able to tell the user that the file name is too long.
    (As the common user isn't thinking in bytes)

  11. takerukoushirou commented on Sep 13, 2025

    @takerukoushirou

    That sounds great and @AlexAndBear many thanks for the quick reaction!

    From a user's perspective, I personally wouldn't mind much that an error message doesn't tell the explicit character limit:
    If I type a resource name and then at some point the error shows up, I have a pretty good idea when I reached the length limit. Only pasting a name could lead to carefully editing until the error message vanishes.

    And as currently, that a filename is being edited and is immediately over limit (where you wonder why, as the file exists with the long name): this wouldn't happen anymore as (I assume) uploads with filenames above the 256 bytes limit wouldn't be accepted in the first place.

    It may be useful though for more advanced users who understand the difference between characters and bytes to add a tooltip to the error message (if that is feasible to implement) or link a documentation page that gives some technical insight into the limitation and mentions the 256 bytes limit.

    Another idea may be to tell the user roughly (due to the varying sequence lengths) how many characters they are over the limit, counting from the first character whose byte sequence didn't fit into the first 256 bytes block anymore.

  12. AlexAndBear commented on Sep 15, 2025

    @AlexAndBear
    Member

    @takerukoushirou TYSM, see the related PR #1187

  13. takerukoushirou commented on Sep 16, 2025

    @takerukoushirou

    @AlexAndBear awesome, and thank you very much for the super fast implementation!

  14. kulmann commented on Sep 16, 2025

    @kulmann
    Member

    @takerukoushirou fyi, this fix will be included in the next rolling release of OpenCloud, which is expected to be early next week (most likely on 23rd or 24th of September).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions