Skip to content

Commit 6cee307

Browse files
committed
Throw error on trailing slash server URL #566
1 parent 17ef679 commit 6cee307

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

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

0 commit comments

Comments
 (0)