mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-12-21 15:59:48 +01:00
Fix repository viewer for filenames which contains a hash (#1776)
Add missing url encoding for file links in the repository viewer. Fixes #1766
This commit is contained in:
2
gradle/changelog/filename_with_hash.yaml
Normal file
2
gradle/changelog/filename_with_hash.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
- type: fixed
|
||||||
|
description: Repository viewer filename with hash ([#1766](https://github.com/scm-manager/scm-manager/issues/1766) and [#1776](https://github.com/scm-manager/scm-manager/pull/1776))
|
||||||
@@ -144,7 +144,7 @@ const Breadcrumb: FC<Props> = ({
|
|||||||
return (
|
return (
|
||||||
<li className="is-active" key={index}>
|
<li className="is-active" key={index}>
|
||||||
<Link className="is-ellipsis-overflow" to="#" aria-current="page">
|
<Link className="is-ellipsis-overflow" to="#" aria-current="page">
|
||||||
{pathFragment}
|
{decodeURIComponent(pathFragment)}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
@@ -156,7 +156,7 @@ const Breadcrumb: FC<Props> = ({
|
|||||||
title={pathFragment}
|
title={pathFragment}
|
||||||
to={baseUrl + "/" + encodeURIComponent(revision) + "/" + currPath}
|
to={baseUrl + "/" + encodeURIComponent(revision) + "/" + currPath}
|
||||||
>
|
>
|
||||||
{pathFragment}
|
{decodeURIComponent(pathFragment)}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export const createRelativeLink = (repositoryUrl: string) => {
|
|||||||
export const createFolderLink = (base: string, file: File) => {
|
export const createFolderLink = (base: string, file: File) => {
|
||||||
let link = base;
|
let link = base;
|
||||||
if (file.path) {
|
if (file.path) {
|
||||||
let path = file.path;
|
let path = file.path.split("/").map(encodeURIComponent).join("/");
|
||||||
if (path.startsWith("/")) {
|
if (path.startsWith("/")) {
|
||||||
path = path.substring(1);
|
path = path.substring(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user