mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
perf(PJAX): set proper url for blobs
Gitako used to request tree path for blobs, which causes 301
This commit is contained in:
parent
c625121735
commit
0ae743e10c
2 changed files with 3 additions and 3 deletions
|
|
@ -24,8 +24,8 @@ async function getTreeData({ userName, repoName, branchName, accessToken }) {
|
|||
return await request(url, { accessToken })
|
||||
}
|
||||
|
||||
function getUrlForRedirect({ userName, repoName, branchName }, path) {
|
||||
return `https://github.com/${userName}/${repoName}/tree/${branchName}/${path}`
|
||||
function getUrlForRedirect({ userName, repoName, branchName }, type = 'blob', path) {
|
||||
return `https://github.com/${userName}/${repoName}/${type}/${branchName}/${path}`
|
||||
}
|
||||
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ function parse(treeData, metaData) {
|
|||
...item,
|
||||
name: item.path.replace(/^.*\//, ''),
|
||||
url: item.url
|
||||
? GitHubHelper.getUrlForRedirect(metaData, item.path)
|
||||
? GitHubHelper.getUrlForRedirect(metaData, item.type, item.path)
|
||||
: null,
|
||||
contents: item.type === 'tree' ? [] : null,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue