MuseScore icon indicating copy to clipboard operation
MuseScore copied to clipboard

[MU4 Issue] Workspace - Workspace Name Character Limit

Open lengthwave opened this issue 2 years ago • 1 comments

Describe the bug There is an ambiguous error when typing reeeeeeeeaaaaaallly long Workspace names. It could be better to give a fixed character limit prompt to the user instead of "cannot be used".

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Workspaces'
  2. Click on 'Create new workspace'
  3. Create a really, really long name
  4. See issue

Note: trying to test the limits of this, i did ignore the warning and was able to get it to accept it. Surprisingly, nothing broke with such a long name.

Expected behavior A warning that tells that workspace name should be less than X characters.

Screenshots Screen Shot 2022-04-25 at 6 54 19 PM Screen Shot 2022-04-25 at 6 55 18 PM Screen Shot 2022-04-25 at 6 55 34 PM

Platform information OS: macOS 12.2, Arch.: x86_64 MuseScore version (64-bit): 4.0.0-2214419458 revision: github-musescore-musescore-df96a36

lengthwave avatar Apr 25 '22 16:04 lengthwave

I suggest a cap of 24 characters. A user should not be able to enter more than that in the text field.

Tantacrul avatar Apr 25 '22 16:04 Tantacrul

@HemantAntony - wondering if you'd like this too?

Tantacrul avatar Aug 28 '22 18:08 Tantacrul

I'll take a look!

HemantAntony avatar Aug 29 '22 01:08 HemantAntony

The workspace name is checked according to mu::io::isAllowedFileName function in src/framework/global/io/path.cpp. Also, this function is only used for this issue, checking the workspace name (here in newworkspacemodel.cpp). The relevant code in path.cpp is:

    // Check for trailing periods or spaces
    if (fn.back() == '.' || fn.back() == ' ') {
        return false;
    }

    // Check for pathnames that are too long
    if (fn.size() > 96) {
        return false;
    }

The error in the first image is due to trailing space, and not due to length. Of course the code also shows that the max length is actually 96. Hmmm... should we modify the path.cpp or the newworkspacemodel.cpp?

poypoyan avatar Nov 01 '22 20:11 poypoyan

Fixed in #14288

DmitryArefiev avatar Nov 11 '22 16:11 DmitryArefiev