[fix](ui)(fe-system) fix fe System Info query error when the fe server run in Windows. (#20072) (#20073)

1. Fix duplicate '/' in front-end request URI.
2. When the FileSystemSeparator is '\\', replace '\\' as '/'

Co-authored-by: labuladuo <labuladuo@douyu.tv>
This commit is contained in:
ZhouZhou
2023-05-26 15:25:44 +08:00
committed by GitHub
parent 0ed817ed1a
commit 635a9f7a0e
2 changed files with 8 additions and 1 deletions

View File

@ -190,6 +190,10 @@ public class SystemController extends BaseController {
if (path == null) {
return "/rest/v1/system";
} else {
final String windowsFileSystemSeparator = "\\";
if (windowsFileSystemSeparator.equals(path.getFileSystem().getSeparator())) {
return "/rest/v1/system?path=" + path.toString().replace("\\", "/");
}
return "/rest/v1/system?path=" + path.toString();
}
}

View File

@ -30,7 +30,10 @@ function getLinkItem(text, record, index, isInner, item, hrefColumn, path){
if (record.__hrefPaths[hrefColumn.indexOf(item)].includes('http')) {
return <a href={record.__hrefPaths[hrefColumn.indexOf(item)]} target="_blank">{text}</a>;
}
return <Link to={path+(location.search?location.search:isInner)+'/'+text}>{text}</Link>;
if (location.search[location.search.length -1] === '/') {
return <Link to={path+location.search+text}>{text}</Link>;
}
return <Link to={path+(location.search?location.search:isInner)+'/'+text}>{text}</Link>;
}
return text === '\\N' ? '-' : text;
}