Skip to content

Commit

Permalink
fix: don't use "/" as suffix if public-url starts with ./
Browse files Browse the repository at this point in the history
  • Loading branch information
j-brn authored and ctron committed Dec 12, 2023
1 parent 8e0026c commit c2be116
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ static CWD: Lazy<PathBuf> =

/// Ensure the given value for `--public-url` is formatted correctly.
pub fn parse_public_url(val: &str) -> Result<String, Infallible> {
let prefix = if !val.starts_with('/') { "/" } else { "" };
let prefix = if val.starts_with('/') || val.starts_with("./") {
""
} else {
"/"
};
let suffix = if !val.ends_with('/') { "/" } else { "" };
Ok(format!("{}{}{}", prefix, val, suffix))
}
Expand Down

0 comments on commit c2be116

Please sign in to comment.