Fix not escaped branch in URL (#486)

fixes: #482
This commit is contained in:
GyuYong Jung 2018-01-29 02:47:22 +09:00 committed by Buu Nguyen
parent 44ea432bbf
commit b5cfbe4c08
2 changed files with 5 additions and 5 deletions

View File

@ -138,7 +138,7 @@ class Adapter {
} else {
// encodes but retains the slashes, see #274
const encodedPath = path.split('/').map(encodeURIComponent).join('/')
const url = this._getItemHref(repo, type, encodedPath)
const url = this._getItemHref(repo, type, encodedPath, opts.encodedBranch)
item.a_attr = {
href: url,
'data-download-url': url,
@ -371,8 +371,8 @@ class Adapter {
* Returns item's href value.
* @api protected
*/
_getItemHref(repo, type, encodedPath) {
return `/${repo.username}/${repo.reponame}/${type}/${repo.branch}/${encodedPath}`
_getItemHref(repo, type, encodedPath, encodedBranch) {
return `/${repo.username}/${repo.reponame}/${type}/${encodedBranch}/${encodedPath}`
}
/**
* Returns patch's href value.

View File

@ -202,7 +202,7 @@ class Bitbucket extends PjaxAdapter {
}
// @override
_getItemHref(repo, type, encodedPath) {
return `/${repo.username}/${repo.reponame}/src/${repo.branch}/${encodedPath}`
_getItemHref(repo, type, encodedPath, encodedBranch) {
return `/${repo.username}/${repo.reponame}/src/${encodedBranch}/${encodedPath}`
}
}