Skip to content

Commit c265fde

Browse files
committed
Throw error on trailing slash server URL #566
1 parent f697ec0 commit c265fde

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/src/config.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,11 @@ pub fn build_config(opts: Opts) -> AtomicServerResult<Config> {
280280

281281
// This logic could be a bit too complicated, but I'm not sure on how to make this simpler.
282282
let server_url = if let Some(addr) = opts.server_url.clone() {
283-
addr
283+
if addr.ends_with('/') {
284+
return Err("The Server URL should not end with a trailing slash.".into());
285+
} else {
286+
addr
287+
}
284288
} else if opts.https && opts.port_https == 443 || !opts.https && opts.port == 80 {
285289
format!("{}://{}", schema, opts.domain)
286290
} else {

0 commit comments

Comments
 (0)