Skip to content

feat: guarantee correct URL#996

Merged
jkowalleck merged 5 commits intoCycloneDX:mainfrom
mLuca:992-assert-correct-url
Dec 11, 2023
Merged

feat: guarantee correct URL#996
jkowalleck merged 5 commits intoCycloneDX:mainfrom
mLuca:992-assert-correct-url

Conversation

@mLuca
Copy link
Contributor

@mLuca mLuca commented Dec 5, 2023

Serialization/normalization guarantees valid URI values according to JSON/XML specification

fixes #992

@mLuca mLuca requested a review from a team as a code owner December 5, 2023 08:42
@mLuca
Copy link
Contributor Author

mLuca commented Dec 5, 2023

I am not a Typescript developer, yet I want to have this fix -> I propose a concept for fixing this issue in order to get feedback

@jkowalleck jkowalleck changed the title Fix Issue #922 Assert correct URL feat: assert correct URL Dec 5, 2023
@jkowalleck jkowalleck added the enhancement New feature or request label Dec 5, 2023
@jkowalleck
Copy link
Member

jkowalleck commented Dec 5, 2023

✖️ the proposed solution is insufficient. it will double-encode.
test with an already properly encoded url:

encodeURI("https://acme.org/foo%5B%5D=bar")
// actual: "https://acme.org/foo%255B%255D=bar"
// expected: "https://acme.org/foo%5B%5D=bar"

please find a different solution.

@jkowalleck jkowalleck marked this pull request as draft December 6, 2023 13:43
mzl2fe added 2 commits December 6, 2023 15:48
Show exemplary use of encodeURI().
Also show how to access URL when optional in a class.
Show that tests till succeed.

Signed-off-by: mzl2fe <luca.mazzon@etas.com>
Since encodeURI() was encoding too rigorously a new helper function was
introduced which can be configured to our specific needs.

Signed-off-by: mzl2fe <luca.mazzon@etas.com>
@mLuca mLuca force-pushed the 992-assert-correct-url branch from 150befb to 7c5705a Compare December 6, 2023 14:48
@mLuca mLuca requested a review from jkowalleck December 6, 2023 14:50
@jkowalleck
Copy link
Member

@mLuca i will add unit tests and fix your implementation.

@jkowalleck
Copy link
Member

added the tests, fixed the implementation.
done via 95fb7c9

@jkowalleck jkowalleck marked this pull request as ready for review December 11, 2023 12:02
@jkowalleck jkowalleck changed the title feat: assert correct URL feat: guarantee correct URL Dec 11, 2023
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
@jkowalleck jkowalleck self-requested a review December 11, 2023 12:08
@jkowalleck jkowalleck merged commit b5bda04 into CycloneDX:main Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

guarantee correct URLs

2 participants