mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-05-07 05:16:04 +02:00
Fix Permalink generation for line numbers in code view
To properly escape branch names containing special characters like `/` (e.g., replaced with `%2F`). This ensures that copied links work correctly even when branch names include special characters.
This commit is contained in:
2
gradle/changelog/copy_permalink.yaml
Normal file
2
gradle/changelog/copy_permalink.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
- type: fixed
|
||||
description: Permalink generation for line numbers in code view
|
||||
@@ -38,7 +38,7 @@ const SourcecodeViewer: FC<Props> = ({ file, language }) => {
|
||||
return <Loading />;
|
||||
}
|
||||
|
||||
const permalink = replaceBranchWithRevision(location.pathname, file.revision);
|
||||
const permalink = replaceBranchWithRevision(location.pathname, encodeURIComponent(file.revision));
|
||||
|
||||
return <SyntaxHighlighter language={language.toLowerCase()} value={content || ""} permalink={permalink} />;
|
||||
};
|
||||
|
||||
@@ -47,7 +47,7 @@ const SwitchableMarkdownViewer: FC<Props> = ({ file, basePath, repository }) =>
|
||||
return <ErrorNotification error={error} />;
|
||||
}
|
||||
|
||||
const permalink = replaceBranchWithRevision(location.pathname, file.revision);
|
||||
const permalink = replaceBranchWithRevision(location.pathname, encodeURIComponent(file.revision));
|
||||
|
||||
return (
|
||||
<div className="is-relative">
|
||||
|
||||
Reference in New Issue
Block a user