MuseScore
MuseScore copied to clipboard
[MU4 Issue] Workspace - Workspace Name Character Limit
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:
- Go to 'Workspaces'
- Click on 'Create new workspace'
- Create a really, really long name
- 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
Platform information OS: macOS 12.2, Arch.: x86_64 MuseScore version (64-bit): 4.0.0-2214419458 revision: github-musescore-musescore-df96a36
I suggest a cap of 24 characters. A user should not be able to enter more than that in the text field.
@HemantAntony - wondering if you'd like this too?
I'll take a look!
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?
Fixed in #14288