Skip to content

Commit

Permalink
frontend: fix wrong success on not defined action
Browse files Browse the repository at this point in the history
Motivation

when modifying attributes using  restful api `action` an error is occurring if not defined action is used.
The return message is `success`, while an error message should be returned.

example:

curl   -X  POST -u admin:dickerelch  -H "Accept: application/json"  -H "Content-Type: application/json"  http://localhost:3880/api/v1/namespace/public/teddst_label2.log -d  '{"action" : "set-label",    "labels" : [ "cat", "paris"] }'
{"status":"success"}[marina@localhost dcache]$

Result

An error message will be returned when wrong action is used: {"errors":[{"message":"No such acction set-label","status":"400"}]

Target: master, 7.0, 6.1, 6.0, 5.2,
Require-book: no
Require-notes: yes
Acked-by: Tigran Mkrtchyan
Commit:
  • Loading branch information
mksahakyan committed Jun 15, 2021
1 parent ac3a3e4 commit dc4e6db
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ public Response cmrResources(@ApiParam(value="Path of file or directory to be mo
int mode = reqPayload.getInt("mode");
pnfsHandler.setFileAttributes(path, FileAttributes.ofMode(mode));
break;
default:
throw new UnsupportedOperationException("No such action " + action);
}
} catch (FileNotFoundCacheException e) {
throw new NotFoundException(e);
Expand Down

0 comments on commit dc4e6db

Please sign in to comment.