-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FolderExplorer: "new folder" issues #743
Comments
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible. |
Fixes for #743: no encoding, special characters, displaying error
Hi @nbelyh, I've fixed 1, 2, and 4. Please, check beta version. For the 3 - I don't see a value of doing that as the folder is created almost instantly. Even in OOB UI when you press ESC - the dialog is closed, but the folder is still being created. I would consider adding some events like |
@AJIXuMuK This is awesome! 😄 The third item can be thought of later, it's not critical at all, can be left as is I guess! The space character was the only critical issue here for me. |
Seems to work great 👍 |
Category
[ ] Enhancement
[x] Bug
[ ] Question
Version
Please specify what version of the library you are using: [2.1.0]
Description
New folder name is unnecessarily encoded. If you enter 'A B' as a folder name, you get 'A%20B'. Space is a valid character for a folder name, according to the documentation:
https://support.microsoft.com/en-us/office/invalid-file-names-and-file-types-in-onedrive-and-sharepoint-64883a5d-228e-48f5-b3d2-eb39e07630fa
there is no check for invalid symbols. If you create a new folder in SharePoint UI you have an error message like this:
There is no way to cancel creation of the folder once you started it (no cancel button and escape does not work)
There is no error shown in case folder is not created (just a log entry in console). If error happens, the control gets "stuck" in the "saving" mode here, "loading" is never reset:
sp-dev-fx-controls-react/src/controls/folderExplorer/NewFolder/NewFolder.tsx
Line 95 in dda0256
Expected
Possible solutions
There is "blunt" encoding here (should be smarter than this; it's not all "invalid URI characters" that are prohibited). More precisely,
encodeURIComponent(name)
seems to be a bad idea. If (2) is fixed then this encoding can be probably be just removed (in case something is wrong, the API call will throw an exception):sp-dev-fx-controls-react/src/services/FolderExplorerService.ts
Line 104 in dda0256
Here a validation (errorMessage) property is probably needed, that will check proper characters. Since spfx controls don't care about 2013, the latest invalid character set can be taken, see here. And translation of that to all supported languages:
sp-dev-fx-controls-react/src/controls/folderExplorer/NewFolder/NewFolder.tsx
Lines 44 to 49 in 84d2b51
Not quite sure how to deal with this one.. Maybe using a focus (lock) somehow? Now the thing is the focus can can close the whole dialog/sidebar where the control is located, instead of just cancelling folder creation.
I think at least the state "loading" should be reset here on exception. Ideally, there should an error message (localized) like "failed to add folder" or something that is set as errorMessage for the
<TextField>
The text was updated successfully, but these errors were encountered: