Skip to content

Commit f300aff

Browse files
committed
Throw error on trailing slash server URL #566
1 parent c9b8a0b commit f300aff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/src/config.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,11 @@ pub fn build_config(opts: Opts) -> AtomicServerResult<Config> {
303303

304304
// This logic could be a bit too complicated, but I'm not sure on how to make this simpler.
305305
let server_url = if let Some(addr) = opts.server_url.clone() {
306-
addr
306+
if addr.ends_with('/') {
307+
return Err("The Server URL should not end with a trailing slash.".into());
308+
} else {
309+
addr
310+
}
307311
} else if opts.https && opts.port_https == 443 || !opts.https && opts.port == 80 {
308312
format!("{}://{}", schema, opts.domain)
309313
} else {

0 commit comments

Comments
 (0)