mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: handle blob and tree URL
This commit is contained in:
parent
3da6082f7e
commit
e36aa412d0
2 changed files with 4 additions and 4 deletions
|
|
@ -17,7 +17,7 @@ const init = dispatch => async () => {
|
|||
const metaData = URLHelper.parse()
|
||||
if (DOMHelper.isInCodePage()) {
|
||||
detectedBranchName = DOMHelper.getCurrentBranch() // not working well with non-branch blob
|
||||
|| URLHelper.parseBlobSHA() // cannot handle '/' split branch name, should not use when possibly on branch page
|
||||
|| URLHelper.parseSHA() // cannot handle '/' split branch name, should not use when possibly on branch page
|
||||
}
|
||||
metaData.branchName = detectedBranchName || 'master'
|
||||
dispatch(setMetaData, metaData)
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ function parse() {
|
|||
}
|
||||
}
|
||||
|
||||
function parseBlobSHA() {
|
||||
function parseSHA() {
|
||||
const { type, path } = parse()
|
||||
return type === 'blob' ? path[0] : false
|
||||
return (type === 'blob' || type === 'tree') ? path[0] : false
|
||||
}
|
||||
|
||||
function isInRepoPage() {
|
||||
|
|
@ -81,5 +81,5 @@ export default {
|
|||
isInRepoPage,
|
||||
isInCodePage,
|
||||
parse,
|
||||
parseBlobSHA,
|
||||
parseSHA,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue