diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index a6dc2658..759165de 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -92,8 +92,8 @@ class CoderRootDirectory extends Component { const { branchName , owner , projectsId } = this.props.match.params; const { defaultBranch } = this.props; let branch = branchName || defaultBranch; - if (pathname && (pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf("/tree/") > -1)) { - let url = pathname.split("/tree/")[1]; + if (pathname && (pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${branchName}/`) > -1)) { + let url = pathname.split(`/tree/${branchName}/`)[1]; this.setState({treeValue:url}) this.getFileDetail(decodeURI(url),branch); } else { @@ -108,7 +108,7 @@ class CoderRootDirectory extends Component { readOnly:true, treeValue:undefined }) - this.props.history.push(`/projects/${owner}/${projectsId}${branchName?`/branch/${branchName}`:""}`); + this.props.history.push(`/projects/${owner}/${projectsId}${branchName?`/tree/${branchName}`:""}`); this.getProjectRoot(branch); }; @@ -235,7 +235,8 @@ class CoderRootDirectory extends Component { chooseType:type }) const { projectsId, owner , branchName } = this.props.match.params; - this.props.history.push(`/projects/${owner}/${projectsId}${branchName?`/branch/${branchName}`:""}${path?`/tree/${path}`:""}`); + const { defaultBranch } = this.props; + this.props.history.push(`/projects/${owner}/${projectsId}${`/tree/${branchName || defaultBranch}`}${path?`/${path}`:""}`); if(filename.substring(filename.length - 3) === ".md"){ this.setState({ md:true @@ -290,7 +291,7 @@ class CoderRootDirectory extends Component { changeBranch = (value) => { const { projectsId , owner } = this.props.match.params; const { treeValue } = this.state; - let url = `/projects/${owner}/${projectsId}${value && `/branch/${value}`}${treeValue ? `/tree/${treeValue}`:""}`; + let url = `/projects/${owner}/${projectsId}${value && `/tree/${value}`}${treeValue ? `/${treeValue}`:""}`; this.props.history.push(url); } diff --git a/src/forge/Main/CoderRootIndex.js b/src/forge/Main/CoderRootIndex.js index 27dbbb9d..0e9c7207 100644 --- a/src/forge/Main/CoderRootIndex.js +++ b/src/forge/Main/CoderRootIndex.js @@ -145,7 +145,7 @@ class CoderRootIndex extends Component{ () => () } > - () } diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 887896d8..df8a94e5 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -730,7 +730,7 @@ class Detail extends Component { (props) => () } > - () }