mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
Encode branch in urls
This commit is contained in:
@@ -44,9 +44,9 @@ class Sources extends React.Component<Props> {
|
|||||||
let url;
|
let url;
|
||||||
if (branch) {
|
if (branch) {
|
||||||
if (path) {
|
if (path) {
|
||||||
url = `${baseUrl}/${branch.name}/${path}`;
|
url = `${baseUrl}/${encodeURIComponent(branch.name)}/${path}`;
|
||||||
} else {
|
} else {
|
||||||
url = `${baseUrl}/${branch.name}/`;
|
url = `${baseUrl}/${encodeURIComponent(branch.name)}/`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
url = `${baseUrl}/`;
|
url = `${baseUrl}/`;
|
||||||
@@ -98,6 +98,7 @@ class Sources extends React.Component<Props> {
|
|||||||
const mapStateToProps = (state, ownProps) => {
|
const mapStateToProps = (state, ownProps) => {
|
||||||
const { repository, match } = ownProps;
|
const { repository, match } = ownProps;
|
||||||
const { revision, path } = match.params;
|
const { revision, path } = match.params;
|
||||||
|
const decodedRevision = revision ? decodeURIComponent(revision) : undefined;
|
||||||
|
|
||||||
const loading = isFetchBranchesPending(state, repository);
|
const loading = isFetchBranchesPending(state, repository);
|
||||||
const error = getFetchBranchesFailure(state, repository);
|
const error = getFetchBranchesFailure(state, repository);
|
||||||
@@ -105,7 +106,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
repository,
|
repository,
|
||||||
revision,
|
revision: decodedRevision,
|
||||||
path,
|
path,
|
||||||
loading,
|
loading,
|
||||||
error,
|
error,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ function createUrl(repository: Repository, revision: string, path: string) {
|
|||||||
|
|
||||||
// TODO handle trailing slash
|
// TODO handle trailing slash
|
||||||
const pathDefined = path ? path : "";
|
const pathDefined = path ? path : "";
|
||||||
return `${base}${revision}/${pathDefined}`;
|
return `${base}${encodeURIComponent(revision)}/${pathDefined}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchSourcesPending(
|
export function fetchSourcesPending(
|
||||||
|
|||||||
Reference in New Issue
Block a user