You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@linkis.apache.org by GitBox <gi...@apache.org> on 2022/06/14 13:00:14 UTC
[GitHub] [incubator-linkis] peacewong commented on a diff in pull request #2277: in the workspace, files can be moved to another folder
peacewong commented on code in PR #2277:
URL: https://github.com/apache/incubator-linkis/pull/2277#discussion_r896786535
##########
linkis-public-enhancements/linkis-publicservice/linkis-script-dev/linkis-storage-script-dev-server/src/main/java/org/apache/linkis/filesystem/restful/api/FsRestfulApi.java:
##########
@@ -213,6 +213,43 @@ public Message rename(HttpServletRequest req, @RequestBody JsonNode json)
return Message.ok();
}
+ @RequestMapping(path = "/move", method = RequestMethod.POST)
+ public Message move(HttpServletRequest req, @RequestBody JsonNode json)
+ throws IOException, WorkSpaceException {
+ String filePath = json.get("filePath").textValue();
Review Comment:
Whether it is necessary to do a null value judgment
##########
linkis-public-enhancements/linkis-publicservice/linkis-script-dev/linkis-storage-script-dev-server/src/main/java/org/apache/linkis/filesystem/restful/api/FsRestfulApi.java:
##########
@@ -213,6 +213,43 @@ public Message rename(HttpServletRequest req, @RequestBody JsonNode json)
return Message.ok();
}
+ @RequestMapping(path = "/move", method = RequestMethod.POST)
+ public Message move(HttpServletRequest req, @RequestBody JsonNode json)
+ throws IOException, WorkSpaceException {
+ String filePath = json.get("filePath").textValue();
+ String newDir = json.get("newDir").textValue();
+ String userName = ModuleUserUtils.getOperationUser(req, "move " + filePath);
+ if (FILESYSTEM_PATH_CHECK_TRIGGER.getValue()) {
+ LOGGER.info(
+ String.format(
+ "path check trigger is open,now check the path,oldDest:%s,newDest:%s",
+ filePath, newDir));
+ PathValidator$.MODULE$.validate(filePath, userName);
+ PathValidator$.MODULE$.validate(newDir, userName);
+ }
+ if (!checkIsUsersDirectory(filePath, userName)) {
+ throw WorkspaceExceptionManager.createException(80010, filePath);
+ }
+ if (StringUtils.isEmpty(newDir)) {
+ throw WorkspaceExceptionManager.createException(80004, newDir);
+ }
+ FsPath flieOldPath = new FsPath(filePath);
+ // 获取文件名
Review Comment:
It is recommended to remove Chinese
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For additional commands, e-mail: notifications-help@linkis.apache.org