diff --git a/src/forge/Component/DrawerPanel.jsx b/src/forge/Component/DrawerPanel.jsx index e9777173c..0e604d593 100644 --- a/src/forge/Component/DrawerPanel.jsx +++ b/src/forge/Component/DrawerPanel.jsx @@ -4,6 +4,12 @@ import './Component.scss'; import axios from 'axios'; const { TreeNode , DirectoryTree } = Tree; +function turnbar(str){ + if(str && str.length>0 && str.indexOf("/")>-1){ + return str.replaceAll('/','%2F'); + } + return str; +} function DrawerPanel({visible,onClose,branch,owner,projectsId,history, name , list}){ const [ treeData , setTreeData ] = useState(undefined); const [ isSpin , setIsSpin ] = useState(true); @@ -71,7 +77,8 @@ function DrawerPanel({visible,onClose,branch,owner,projectsId,history, name , li let dataref = event.node.props.dataRef; if(dataref.type==="file"){ onClose(); - history.push(`/projects/${owner}/${projectsId}/tree/${branch.replaceAll("/","%2F")}/${dataref.path}`); + let value = turnbar(branch); + history.push(`/projects/${owner}/${projectsId}/tree/${value}/${dataref.path}`); } } diff --git a/src/forge/DevOps/Dispose/List.jsx b/src/forge/DevOps/Dispose/List.jsx index e9c9a6a90..4c077452c 100644 --- a/src/forge/DevOps/Dispose/List.jsx +++ b/src/forge/DevOps/Dispose/List.jsx @@ -10,6 +10,12 @@ import { Link } from 'react-router-dom'; // killed:"已撤销", // pending:"准备中" // } +function turnbar(str){ + if(str && str.length>0 && str.indexOf("/")>-1){ + return str.replaceAll('/','%2F'); + } + return str; +} function renderTableStatus(status) { switch (status) { case "running": @@ -65,8 +71,9 @@ function List({ list, operate , projectsId , owner , showModal , deleteFunc }){ width:"15%", ellipsis:true, render:(value,item)=>{ + let v = turnbar(item.branch); return( - {value} + {value} ) } }, diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index a95b84461..ff13b61c7 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -23,6 +23,20 @@ import Nodata from '../Nodata'; /** * projectDetail.type:0是托管项目,1是镜像项目,2是同步镜像项目(为2时不支持在线创建、在线上传、在线修改、在线删除、创建合并请求等功能) */ + +function turnbar(str){ + if(str && str.length>0 && str.indexOf("/")>-1){ + return str.replaceAll('/','%2F'); + } + return str; +} +function returnbar(str){ + if(str && str.length>0 && str.indexOf("%2F")>-1){ + return str.replaceAll('%2F','/'); + } + return str; +} + function CoderDepot(props){ const [ projectDetail , setProjectDetail ]= useState(undefined); const [ treeValue , setTreeValue ] = useState(undefined); @@ -52,7 +66,7 @@ function CoderDepot(props){ const owner = props.match.params.owner; const projectsId = props.match.params.projectsId; let branchName = props.match.params.branchName; - branchName = branchName && branchName.replaceAll("%2F",'/'); + branchName = returnbar(branchName); const details = props.projectDetail; let pathname = props.history.location.pathname; @@ -77,7 +91,7 @@ function CoderDepot(props){ useEffect(()=>{ if (projectsId && owner && defaultBranch){ - let b = branchName && branchName.replaceAll("/","%2F"); + let b = turnbar(branchName) ; if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${b}/`) > -1) { let url = pathname.split(`/tree/${b}/`)[1]; setTreeValue(url); @@ -163,17 +177,19 @@ function CoderDepot(props){ // 切换分支或者标签 function changeBranch(value){ - let url = `/projects/${owner}/${projectsId}${value && `/tree/${value.replaceAll("/","%2F")}`}${treeValue ? `/${treeValue}`:""}`; + let checkvalue = turnbar(value); + let url = `/projects/${owner}/${projectsId}${value && `/tree/${checkvalue}`}${treeValue ? `/${treeValue}`:""}`; props.history.push(url); } // 文件相关的下拉项 function fileMenu(){ let b = branchName || defaultBranch; + let checkvalue = turnbar(b); return (
) } @@ -191,18 +207,20 @@ function CoderDepot(props){ function returnMain(){ setTreeValue(undefined); let branch = branchName || defaultBranch; - props.history.push(`/projects/${owner}/${projectsId}/tree/${branch.replaceAll("/","%2F")}`); + let checkvalue = turnbar(branch); + props.history.push(`/projects/${owner}/${projectsId}/tree/${checkvalue}`); }; // 子目录路径返回链接 function returnUlr(url){ - let enBranch = branchName && branchName.replaceAll("/","%2F"); + let enBranch = turnbar(branchName); props.history.push(`/projects/${owner}/${projectsId}/tree${enBranch?`/${enBranch}`:""}/${url}`); } // 点击跳转到子目录 function goToSubRoot(path,type,filename){ let enBranch = branchName || defaultBranch; + let checkvalue = turnbar(enBranch); setType(type); - props.history.push(`/projects/${owner}/${projectsId}${`/tree/${enBranch.replaceAll("/","%2F")}`}${path?`/${path}`:""}`); + props.history.push(`/projects/${owner}/${projectsId}${`/tree/${checkvalue}`}${path?`/${path}`:""}`); } function onEdit(readOnly){ @@ -211,7 +229,9 @@ function CoderDepot(props){ } function ChangeFile(path, readOnly){ //点击直接跳转页面 加载一次路由 - props.history.push(`/projects/${owner}/${projectsId}/tree/${branchName || defaultBranch}/${path}`); + let enBranch = branchName || defaultBranch; + let checkvalue = turnbar(enBranch); + props.history.push(`/projects/${owner}/${projectsId}/tree/${checkvalue}/${path}`); setType("file"); setEditReadme(true); }; diff --git a/src/forge/Main/CoderRootBranch.js b/src/forge/Main/CoderRootBranch.js index 012429e08..6299adaf8 100644 --- a/src/forge/Main/CoderRootBranch.js +++ b/src/forge/Main/CoderRootBranch.js @@ -6,6 +6,12 @@ import { getBranch } from '../GetData/getData'; import Nodata from '../Nodata'; import './list.css'; +function turnbar(str){ + if(str && str.length>0 && str.indexOf("/")>-1){ + return str.replaceAll('/','%2F'); + } + return str; +} export default ((props)=>{ const [ data , setData ] =useState(undefined); const [ isSpin , setIsSpin ] =useState(true); @@ -32,7 +38,7 @@ export default ((props)=>{ return(
{item.last_commit && truncateCommitId(item.last_commit.sha)}
{item.last_commit && item.last_commit.message}
diff --git a/src/forge/Merge/MergeItem.js b/src/forge/Merge/MergeItem.js
index 74aa512b6..5c08a61f4 100644
--- a/src/forge/Merge/MergeItem.js
+++ b/src/forge/Merge/MergeItem.js
@@ -5,6 +5,12 @@ import { AlignCenter } from '../Component/layout';
import { getImageUrl } from "educoder";
import "./merge.css";
+function turnbar(str){
+ if(str && str.length>0 && str.indexOf("/")>-1){
+ return str.replaceAll('/','%2F');
+ }
+ return str;
+}
class MergeItem extends Component {
constructor(props) {
super(props);
@@ -103,7 +109,7 @@ class MergeItem extends Component {
item.pull_request_head &&