Skip to content

Commit 1f3e404

Browse files
committed
Fix clippy
1 parent ba58e19 commit 1f3e404

File tree

1 file changed

+2
-2
lines changed
  • lib/dsc-lib/src/functions

1 file changed

+2
-2
lines changed

lib/dsc-lib/src/functions/uri.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn combine_uri(base_uri: &str, relative_uri: &str) -> Result<String, DscError> {
4949
return Err(DscError::Parser(t!("functions.uri.invalidRelativeUri").to_string()));
5050
}
5151

52-
if relative_uri.starts_with("//") {
52+
if let Some(uri_without_slashes) = relative_uri.strip_prefix("//") {
5353
// Protocol-relative URI: extract scheme from base
5454
let scheme = if let Some(scheme_end) = base_uri.find("://") {
5555
&base_uri[..scheme_end]
@@ -58,11 +58,11 @@ fn combine_uri(base_uri: &str, relative_uri: &str) -> Result<String, DscError> {
5858
};
5959

6060
// Check if the protocol-relative URI has a path
61-
let uri_without_slashes = &relative_uri[2..]; // Remove leading //
6261
if uri_without_slashes.contains('/') {
6362
// Has a path, use as-is
6463
return Ok(format!("{scheme}:{relative_uri}"));
6564
}
65+
// No path specified, add trailing slash for root
6666
return Ok(format!("{scheme}:{relative_uri}/"));
6767
}
6868

0 commit comments

Comments
 (0)