Skip to content

net/url: Improve documentation for PathUnescape #26139

@tooolbox

Description

@tooolbox

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.10.2

Does this issue reproduce with the latest release?

N/A

What operating system and processor architecture are you using (go env)?

N/A

What did you do?

Looked at the godoc for PathUnescape

What did you expect to see?

PathUnescape does the inverse transformation of PathEscape, converting each 3-byte encoded substring of the form "%AB" into the hex-decoded byte 0xAB. It returns an error if any % is not followed by two hexadecimal digits.

PathUnescape is identical to QueryUnescape except that it does not unescape '+' to ' ' (space).

What did you see instead?

PathUnescape does the inverse transformation of PathEscape, converting each 3-byte encoded substring of the form "%AB" into the hex-decoded byte 0xAB. It also converts '+' into ' ' (space). It returns an error if any % is not followed by two hexadecimal digits.

PathUnescape is identical to QueryUnescape except that it does not unescape '+' to ' ' (space).

Commentary

It seems like the documentation for PathUnescape was copied from QueryUnescape, with the last line added. However, it then contradicts itself about its behavior with + characters.

Fix

Remove the line It also converts '+' into ' ' (space). from the PathUnescape comment. I would submit a PR but the amount of hoops I'd have to jump through to contribute one line of code is a little much; I'd like to ask that someone who's already set up as Go contributor take care of this.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions