Skip to content

Commit 09a0382

Browse files
authored
Fix Windows path-separator leak in brand logo path resolution (#378)
1 parent 4963674 commit 09a0382

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/quarto-brand/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ repository.workspace = true
88
description = "Parse and resolve `_brand.yml` brand configuration for Quarto"
99

1010
[dependencies]
11+
quarto-util = { workspace = true }
1112
serde = { workspace = true }
1213
serde_yaml = { workspace = true }
1314
thiserror = { workspace = true }

crates/quarto-brand/src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,10 @@ impl BrandLogoResource {
535535
/// paths and `http(s)://` URLs are left unchanged.
536536
pub fn with_path_relative_to(&self, base: &Path) -> Self {
537537
let raw = self.path();
538-
let resolved = if is_external_url(raw) || Path::new(raw).is_absolute() {
538+
let resolved = if is_external_url(raw) || quarto_util::is_rooted(Path::new(raw)) {
539539
raw.to_string()
540540
} else {
541-
base.join(raw).to_string_lossy().into_owned()
541+
quarto_util::to_forward_slashes(&base.join(raw))
542542
};
543543
match self {
544544
BrandLogoResource::Path(_) => BrandLogoResource::Path(resolved),

0 commit comments

Comments
 (0)