From f2682e1f041f58e58c5e1e3b55e3c2c6d7420295 Mon Sep 17 00:00:00 2001 From: syapollo Date: Tue, 25 Aug 2020 09:53:54 +0800 Subject: [PATCH] for #3675 --- .../config/server/auth/ConfigResourceParser.java | 13 ++++++------- .../nacos/naming/web/NamingResourceParser.java | 10 ++++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/config/src/main/java/com/alibaba/nacos/config/server/auth/ConfigResourceParser.java b/config/src/main/java/com/alibaba/nacos/config/server/auth/ConfigResourceParser.java index bf31875edfb..a92fd54247d 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/auth/ConfigResourceParser.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/auth/ConfigResourceParser.java @@ -38,19 +38,18 @@ public String parseName(Object request) { String namespaceId = req.getParameter("tenant"); String groupName = req.getParameter("group"); String dataId = req.getParameter("dataId"); - StringBuilder sb = new StringBuilder(); if (StringUtils.isNotBlank(namespaceId)) { sb.append(namespaceId); } - sb.append(Resource.SPLITTER); - - if (StringUtils.isBlank(dataId)) { - sb.append("*").append(Resource.SPLITTER).append(AUTH_CONFIG_PREFIX).append("*"); - } else { - sb.append(groupName).append(Resource.SPLITTER).append(AUTH_CONFIG_PREFIX).append(dataId); + if (StringUtils.isNotBlank(groupName)) { + sb.append(groupName); + } + sb.append(Resource.SPLITTER).append(AUTH_CONFIG_PREFIX); + if (StringUtils.isNotBlank(dataId)) { + sb.append(dataId); } return sb.toString(); diff --git a/naming/src/main/java/com/alibaba/nacos/naming/web/NamingResourceParser.java b/naming/src/main/java/com/alibaba/nacos/naming/web/NamingResourceParser.java index 8024a215ecf..4c3e677de34 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/web/NamingResourceParser.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/web/NamingResourceParser.java @@ -55,10 +55,12 @@ public String parseName(Object request) { sb.append(Resource.SPLITTER); - if (StringUtils.isBlank(serviceName)) { - sb.append("*").append(Resource.SPLITTER).append(AUTH_NAMING_PREFIX).append("*"); - } else { - sb.append(groupName).append(Resource.SPLITTER).append(AUTH_NAMING_PREFIX).append(serviceName); + if (StringUtils.isNotBlank(groupName)) { + sb.append(groupName); + } + sb.append(Resource.SPLITTER).append(AUTH_NAMING_PREFIX); + if (StringUtils.isNotBlank(serviceName)) { + sb.append(serviceName); } return sb.toString();