Skip to content

Commit 45ff229

Browse files
committed
prevent // in uri
1 parent 99a9dc4 commit 45ff229

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mstickerlib/src/matrix/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,10 @@ where
196196
.unwrap_or_else(|| path.as_os_str())
197197
.to_str()
198198
.expect("Not valid UTF-8");
199+
let slash = if matrix.homeserver_url.ends_with('/') { "" } else { "/" };
199200
let answer = CLIENT
200201
.get()
201-
.post(&format!("{}/_matrix/media/v3/upload", matrix.homeserver_url))
202+
.post(&format!("{}{slash}_matrix/media/v3/upload", matrix.homeserver_url))
202203
.query(&[("access_token", matrix.access_token.as_str()), ("filename", filename)])
203204
.header("Content-Type", mimetype)
204205
.body(data.to_owned()) //TODO check for better solution

0 commit comments

Comments
 (0)