mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: resolve path failed before PJAX
This commit is contained in:
parent
632d4a4e35
commit
3439808d63
1 changed files with 8 additions and 2 deletions
|
|
@ -163,8 +163,14 @@ export const GitHub: Platform = {
|
|||
return Boolean(URLHelper.isInPullPage())
|
||||
},
|
||||
getCurrentPath(branchName) {
|
||||
if (URLHelper.parse().path.length) {
|
||||
return DOMHelper.getPath()
|
||||
const pathFromURL = URLHelper.parse().path.join('/')
|
||||
if (pathFromURL.length) {
|
||||
if (branchName && pathFromURL.startsWith(branchName + '/')) {
|
||||
return pathFromURL.replace(branchName + '/', '').split('/')
|
||||
} else {
|
||||
// This would fail before PJAX replace, but works well when no branchName, e.g. first load
|
||||
return DOMHelper.getPath()
|
||||
}
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue