Skip to content

Commit

Permalink
[ISSUE alibaba#11967] Can not aquire the specific config
Browse files Browse the repository at this point in the history
  • Loading branch information
syshenyao authored and yao.shen@hstong.com committed Apr 22, 2024
1 parent 96814ff commit 34f80da
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.alibaba.nacos.config.server.service.dump.disk;

import com.alibaba.nacos.api.utils.StringUtils;
import com.alibaba.nacos.common.pathencoder.PathEncoderManager;
import com.alibaba.nacos.common.utils.IoUtils;
import com.alibaba.nacos.config.server.utils.LogUtil;
import com.alibaba.nacos.sys.env.EnvUtil;
Expand Down Expand Up @@ -65,6 +66,10 @@ public void saveToDisk(String dataId, String group, String tenant, String conten
* Returns the path of the server cache file.
*/
private static File targetFile(String dataId, String group, String tenant) {
// fix https://github.com/alibaba/nacos/issues/10067
dataId = PathEncoderManager.getInstance().encode(dataId);
group = PathEncoderManager.getInstance().encode(group);
tenant = PathEncoderManager.getInstance().encode(tenant);
File file = null;
if (StringUtils.isBlank(tenant)) {
file = new File(EnvUtil.getNacosHome(), BASE_DIR);
Expand All @@ -81,6 +86,10 @@ private static File targetFile(String dataId, String group, String tenant) {
* Returns the path of cache file in server.
*/
private static File targetBetaFile(String dataId, String group, String tenant) {
// fix https://github.com/alibaba/nacos/issues/10067
dataId = PathEncoderManager.getInstance().encode(dataId);
group = PathEncoderManager.getInstance().encode(group);
tenant = PathEncoderManager.getInstance().encode(tenant);
File file = null;
if (StringUtils.isBlank(tenant)) {
file = new File(EnvUtil.getNacosHome(), BETA_DIR);
Expand All @@ -97,6 +106,10 @@ private static File targetBetaFile(String dataId, String group, String tenant) {
* Returns the path of the tag cache file in server.
*/
private static File targetTagFile(String dataId, String group, String tenant, String tag) {
// fix https://github.com/alibaba/nacos/issues/10067
dataId = PathEncoderManager.getInstance().encode(dataId);
group = PathEncoderManager.getInstance().encode(group);
tenant = PathEncoderManager.getInstance().encode(tenant);
File file = null;
if (StringUtils.isBlank(tenant)) {
file = new File(EnvUtil.getNacosHome(), TAG_DIR);
Expand Down

0 comments on commit 34f80da

Please sign in to comment.