Skip to content

Commit

Permalink
优化内链域名特殊字符替换
Browse files Browse the repository at this point in the history
  • Loading branch information
yangzongzhuan committed Dec 1, 2021
1 parent 37fef62 commit cf50772
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ else if (menu.getParentId().intValue() == 0 && isInnerLink(menu))
router.setPath("/inner");
List<RouterVo> childrenList = new ArrayList<RouterVo>();
RouterVo children = new RouterVo();
String routerPath = StringUtils.replaceEach(menu.getPath(), new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" });
String routerPath = innerLinkReplaceEach(menu.getPath());
children.setPath(routerPath);
children.setComponent(UserConstants.INNER_LINK);
children.setName(StringUtils.capitalize(routerPath));
Expand Down Expand Up @@ -358,7 +358,7 @@ public String getRouterPath(SysMenu menu)
// 内链打开外网方式
if (menu.getParentId().intValue() != 0 && isInnerLink(menu))
{
routerPath = StringUtils.replaceEach(routerPath, new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" });
routerPath = innerLinkReplaceEach(routerPath);
}
// 非外链并且是一级目录(类型为目录)
if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType())
Expand Down Expand Up @@ -500,4 +500,15 @@ private boolean hasChild(List<SysMenu> list, SysMenu t)
{
return getChildList(list, t).size() > 0 ? true : false;
}

/**
* 内链域名特殊字符替换
*
* @return
*/
public String innerLinkReplaceEach(String path)
{
return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS },
new String[] { "", "" });
}
}

0 comments on commit cf50772

Please sign in to comment.