Skip to content

Commit b20f813

Browse files
committed
Throw error on trailing slash server URL #566
1 parent aa0dd19 commit b20f813

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
@@ -300,7 +300,11 @@ pub fn build_config(opts: Opts) -> AtomicServerResult<Config> {
300300

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

0 commit comments

Comments
 (0)