v icon indicating copy to clipboard operation
v copied to clipboard

path_escape not escaping `:`

Open prashanth-hegde opened this issue 1 year ago • 1 comments

Describe the bug

path_escape OR url encoding should escape all special characters that happen in url, including : Found that it is not escaping :, but escaping other characters

Expected Behavior

https://play.vlang.io/p/08e93618c1 Refer to https://www.urlencoder.org/ for the correct conversion

Current Behavior

https://play.vlang.io/p/08e93618c1

Reproduction Steps

https://play.vlang.io/p/08e93618c1

Tip: click on the "Test" button to see the expected and actual responses

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.3.2 d62fc77

Environment details (OS name and version, etc.)

MacOs Ventura M1

prashanth-hegde avatar Mar 31 '23 00:03 prashanth-hegde

Please paste your example code directly in the issue. The playground links you gave are no longer valid.

JalonSolov avatar Jun 19 '23 02:06 JalonSolov

done, I have updated the description with code sample

prashanth-hegde avatar Jun 20 '23 12:06 prashanth-hegde

If you want the : (and a few other things) escaped, you need to call query_escape instead of path_escape.

There are different rules for escaping different parts of a URL.

If you want more detail about exactly what is escaped when, read the comments in vlib/net/urllib/urllib.v, check RFC3986, etc.

JalonSolov avatar Jun 20 '23 13:06 JalonSolov