mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-11 20:05:25 +00:00
Correctly build URLs to file paths containing spaces (#364)
Previously, such paths would have their spaces replaced with `/`s, breaking external links to the file. Fixes #249
This commit is contained in:
parent
6d1b8136ae
commit
ebf6721836
2 changed files with 8 additions and 2 deletions
|
|
@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
- Fixed issue with external source code links being broken for paths with spaces. [#364](https://github.com/sourcebot-dev/sourcebot/pull/364)
|
||||
|
||||
## [4.5.0] - 2025-06-21
|
||||
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -106,13 +106,14 @@ const getFileWebUrl = (template: string, branch: string, fileName: string): stri
|
|||
|
||||
const url =
|
||||
template.substring("{{URLJoinPath ".length, template.indexOf("}}"))
|
||||
.replace(".Version", branch)
|
||||
.replace(".Path", fileName)
|
||||
.split(" ")
|
||||
.map((part) => {
|
||||
// remove wrapping quotes
|
||||
if (part.startsWith("\"")) part = part.substring(1);
|
||||
if (part.endsWith("\"")) part = part.substring(0, part.length - 1);
|
||||
// Replace variable references
|
||||
if (part == ".Version") part = branch;
|
||||
if (part == ".Path") part = fileName;
|
||||
return part;
|
||||
})
|
||||
.join("/");
|
||||
|
|
|
|||
Loading…
Reference in a new issue