lgcareer commented on a change in pull request #2732:
URL: 
https://github.com/apache/incubator-dolphinscheduler/pull/2732#discussion_r426457881



##########
File path: 
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
##########
@@ -355,12 +352,21 @@ public Result updateResource(User loginUser,
         String nameWithSuffix = name;
 
         if (!resource.isDirectory()) {
-            //get the file suffix
-            String suffix = 
originResourceName.substring(originResourceName.lastIndexOf("."));
-
-            //if the name without suffix then add it ,else use the origin name
-            if(!name.endsWith(suffix)){
-                nameWithSuffix = nameWithSuffix + suffix;
+            //get the origin file suffix
+            String originSuffix = FileUtils.suffix(originFullName);
+            String suffix = FileUtils.suffix(fullName);
+            if (!suffix.equals(originSuffix)) {
+                //need verify whether this resource is authorized to other 
users
+                Map<String, Object> columnMap = new HashMap<String, Object>();
+                columnMap.put("resources_id", resourceId);
+
+                List<ResourcesUser> resourcesUsers = 
resourceUserMapper.selectByMap(columnMap);
+                if (CollectionUtils.isNotEmpty(resourcesUsers)) {
+                    String users = resourcesUsers.stream().map(t -> 
t.getUserId()).collect(Collectors.toList()).toString();
+                    logger.error("resource is authorized to user {},suffix not 
allowed to be modified", users);

Review comment:
       I agree with you,The message now shows  the user name instead of user id.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to