Skip to content

Replace url.QueryEscape() with url.PathEscape() #674

@udf2457

Description

@udf2457

This is a subtle bug: https://go.dev/play/p/LZdsnzZkgKH

With QueryEscape() spaces are encoded to +

With PathEscape() spaces are encoded to %20

Affects a few other characters too, but space is clearly the most likely use-case that could be hit.

I think its safe to assume TUF is targetting the URL paths, not queries. Therefore correct handling by HTTP servers is only really assured when using PathEscape().

RFC 3396 Section 2.3 : https://www.rfc-editor.org/rfc/rfc3986#section-2.3

PR #675

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions