Skip to content

Commit

Permalink
update rename file error msg (#5753)
Browse files Browse the repository at this point in the history
show detailed msg when failed to rename file because file is locked
  • Loading branch information
imwhatiam authored Nov 11, 2023
1 parent ee40ef0 commit 57d0aad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion frontend/src/pages/lib-content-view/lib-content-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,14 @@ class LibContentView extends React.Component {
seafileAPI.renameFile(repoID, path, newName).then(() => {
this.renameItemAjaxCallback(path, newName);
}).catch((error) => {
let errMessage = Utils.getErrorMsg(error);

let errMessage = "";
if (error.response.status == 403 && error.response.data && error.response.data['error_msg']) {
errMessage = error.response.data['error_msg'];
} else {
errMessage = Utils.getErrorMsg(error);
}

if (errMessage === gettext('Error')) {
let name = Utils.getFileName(path);
errMessage = gettext('Renaming {name} failed').replace('{name}', name);
Expand Down
2 changes: 1 addition & 1 deletion seahub/api2/endpoints/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def post(self, request, repo_id, format=None):

# permission check
if parse_repo_perm(check_folder_permission(request, repo_id, parent_dir)).can_edit_on_web is False:
error_msg = 'Permission denied.'
error_msg = _("Permission denied.")
return api_error(status.HTTP_403_FORBIDDEN, error_msg)

# check file lock
Expand Down

0 comments on commit 57d0aad

Please sign in to comment.