15685: Avoids the webdav service to report server error responses as success.
authorLucas Di Pentima <lucas@di-pentima.com.ar>
Thu, 22 Oct 2020 23:22:56 +0000 (20:22 -0300)
committerLucas Di Pentima <lucas@di-pentima.com.ar>
Thu, 22 Oct 2020 23:22:56 +0000 (20:22 -0300)
This makes the rename file dialog code to report errors correctly.
Probably will fix other file managing issues.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>

src/common/webdav.ts
src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts
src/views-components/rename-file-dialog/rename-file-dialog.tsx

index 17032768fd00436ef92cb4b63d156d0456ddc442..b51cff30703ea51b392b87a2998f9607f052c5a3 100644 (file)
@@ -85,14 +85,16 @@ export class WebDAV {
                 r.upload.addEventListener('progress', config.onUploadProgress);
             }
 
+            // This event gets triggered on *any* server response
             r.addEventListener('load', () => {
-                if (r.status === 404) {
+                if (r.status >= 400) {
                     return reject(r);
                 } else {
                     return resolve(r);
                 }
             });
 
+            // This event gets triggered on network errors
             r.addEventListener('error', () => {
                 return reject(r);
             });
index 704e299990a055742c5a19fdc5cba2e112bc2de0..19f5a7eeffcfe4b83d30e55b0b22a972c32bbeda 100644 (file)
@@ -146,7 +146,7 @@ export const renameFile = (newName: string) =>
                     dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'File name changed.', hideDuration: 2000 }));
                 } catch (e) {
                     const errors: FormErrors<RenameFileDialogData, string> = {
-                        name: 'Could not rename the file'
+                        name: `Could not rename the file: ${e.responseText}`
                     };
                     dispatch(stopSubmit(RENAME_FILE_DIALOG, errors));
                 }
index 1a806511523b6e0bc3fabeb1322a72ba615e3fcf..d05c110b7b3971e44e0aed7d700182e96d9b7fcb 100644 (file)
@@ -37,5 +37,5 @@ const RenameDialogFormFields = (props: WithDialogProps<RenameFileDialogData>) =>
         component={TextField}
         autoFocus={true}
     />
-    <WarningCollection text="Renaming a file will change content address." />
+    <WarningCollection text="Renaming a file will change the collection's content address." />
 </>;