althonos / packageurl.rs

Rust implementation of the Package URL specification.
MIT License
8 stars 6 forks source link

ensure that % is escaped during percent encoding #15

Closed jcreekmore closed 1 month ago

jcreekmore commented 1 month ago

Since the % sign is used for the escape in percent encoding, we need to ensure that that is itself escaped if found in the input. Debian git tags in vcs_urls in particular seem to be moving to replacing the : in a version like 1:41.1 into 1%41.1. The correct encoding of that winds up being 1%2541.1. Without this, adding the vcs_url as it is given will wind up forcing the parsing of the subsequent displayed PackageUrl to decode the 1%41.1 as 1A.1.

Fixes #12.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Please upload report for BASE (master@3dd4756). Learn more about missing BASE report. Report is 45 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #15 +/- ## ========================================= Coverage ? 86.15% ========================================= Files ? 7 Lines ? 260 Branches ? 0 ========================================= Hits ? 224 Misses ? 36 Partials ? 0 ``` | [Flag](https://app.codecov.io/gh/althonos/packageurl.rs/pull/15/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martin+Larralde) | Coverage Δ | | |---|---|---| | [default](https://app.codecov.io/gh/althonos/packageurl.rs/pull/15/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martin+Larralde) | `84.61% <ø> (?)` | | | [memchr](https://app.codecov.io/gh/althonos/packageurl.rs/pull/15/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martin+Larralde) | `84.61% <ø> (?)` | | | [rust-beta](https://app.codecov.io/gh/althonos/packageurl.rs/pull/15/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martin+Larralde) | `86.15% <ø> (?)` | | | [rust-nightly](https://app.codecov.io/gh/althonos/packageurl.rs/pull/15/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martin+Larralde) | `86.15% <ø> (?)` | | | [rust-stable](https://app.codecov.io/gh/althonos/packageurl.rs/pull/15/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martin+Larralde) | `86.15% <ø> (?)` | | | [serde](https://app.codecov.io/gh/althonos/packageurl.rs/pull/15/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martin+Larralde) | `84.61% <ø> (?)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martin+Larralde#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

ctron commented 1 month ago

Thanks for the PR. It's released as 0.4.1, which also has some compatibility for the 0.3.x version.

jcreekmore commented 1 month ago

Thanks!