Skip to content

Commit 0d44635

Browse files
authored
Ensure temporary files are given legal filenames (#126)
The short_file value for some URLs may result in the string "/". For example, this URL: http://te-home.net/?do=hublist&get=hublist.config.bz2 results in: short_file: / full_file: /?do=hublist&get=hublist.config.bz2 this makes it impossible to save the file. With this change, a random file name is chosen.
1 parent 62985c7 commit 0d44635

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/net/http_client.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ let wget r f =
436436

437437
let base = Filename.basename r.req_url.Url.short_file in
438438
(* Base could be "." for http://site.com/ *)
439-
let base = if base = "."
439+
let base = if base = "." || base = "/"
440440
then begin
441441
let prng = Random.State.make_self_init () in
442442
let rnd = (Random.State.bits prng) land 0xFFFFFF in

0 commit comments

Comments
 (0)