From 6e415611244500db72992cf3a5524b98017c9e41 Mon Sep 17 00:00:00 2001 From: JalonSolov Date: Sat, 12 Jun 2021 18:40:32 -0400 Subject: [PATCH] net: fix download_file (#10439) --- vlib/net/http/request.v | 2 +- vlib/net/urllib/urllib.v | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/net/http/request.v b/vlib/net/http/request.v index f371fbbc70..5b87e90f4c 100644 --- a/vlib/net/http/request.v +++ b/vlib/net/http/request.v @@ -74,7 +74,7 @@ pub fn (req &Request) do() ?Response { fn (req &Request) method_and_url_to_response(method Method, url urllib.URL) ?Response { host_name := url.hostname() scheme := url.scheme - p := url.path.trim_left('/') + p := url.escaped_path().trim_left('/') path := if url.query().len > 0 { '/$p?$url.query().encode()' } else { '/$p' } mut nport := url.port().int() if nport == 0 { diff --git a/vlib/net/urllib/urllib.v b/vlib/net/urllib/urllib.v index ddeb3472a7..3b02ef674e 100644 --- a/vlib/net/urllib/urllib.v +++ b/vlib/net/urllib/urllib.v @@ -649,7 +649,7 @@ pub fn (mut u URL) set_path(p string) ?bool { // their results. // In general, code should call escaped_path instead of // reading u.raw_path directly. -fn (u &URL) escaped_path() string { +pub fn (u &URL) escaped_path() string { if u.raw_path != '' && valid_encoded_path(u.raw_path) { unescape(u.raw_path, .encode_path) or { return '' } return u.raw_path