Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PermissionDataAspect.filterUrl() 方法有代码bug #2325

Closed
YoungWang1228 opened this issue Mar 4, 2021 · 6 comments
Closed

PermissionDataAspect.filterUrl() 方法有代码bug #2325

YoungWang1228 opened this issue Mar 4, 2021 · 6 comments

Comments

@YoungWang1228
Copy link

版本号:

2.4.2,master 代码分支

问题描述:

PermissionDataAspect.filterUrl() 方法,第 72 行 处理的返回值被丢弃了

截图&代码:
    private String filterUrl(String requestPath){
        String url = "";
        if(oConvertUtils.isNotEmpty(requestPath)){
            url = requestPath.replace("\\", "/");
            url = requestPath.replace("//", "/");
            if(url.indexOf("//")>=0){
                url = filterUrl(url);
            }
			/*if(url.startsWith("/")){
				url=url.substring(1);
			}*/
        }
        return url;
    }

这个处理的返回值被丢了
url = requestPath.replace("\\", "/");

友情提示: 未按格式要求发帖,会直接删掉。

@tygithub1
Copy link

请说明场景

@YoungWang1228
Copy link
Author

请说明场景

代码编写错误,返回值被丢了,说明啥场景?

@tygithub1
Copy link

使用场景,怎么重现问题

@zhangdaiscott
Copy link
Member

没理解,这个只是替换了分隔符,返回值丢了是指的什么

@YoungWang1228
Copy link
Author

    private String filterUrl(String requestPath){
        String url = "";
        if(oConvertUtils.isNotEmpty(requestPath)){
            url = requestPath.replace("\\", "/");
            url = requestPath.replace("//", "/");
            if(url.indexOf("//")>=0){
                url = filterUrl(url);
            }
			/*if(url.startsWith("/")){
				url=url.substring(1);
			}*/
        }
        return url;
    }

看看这两行

 ...
  url = requestPath.replace("\\", "/");
  url = requestPath.replace("//", "/");
 ...

上一行的替换 \\ 的操作,替换后的串是变量 url, 紧接着下一行又替换 // 同样赋值给 url,是不是把上一行的替换结果给丢了?

@zhangdaiscott
Copy link
Member

已经处理,下个版本发布

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants