Skip to content

devpkg: better handling of escapes in flakeref paths #1598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 1, 2023

Conversation

gcurtis
Copy link
Collaborator

@gcurtis gcurtis commented Oct 31, 2023

Split flakeref paths before unescaping to properly handle encoded slashes (%2F). Use URL.String() to ensure that unescaped characters get re-escaped for FlakeRef.URL.

Improve FlakeRef.String so that it reassembles the flakeref using the
current field values instead of returning the original parsed string
that it came from. This makes it easier to modify parsed flakerefs or to
create new ones from scratch.

The strings are normalized so that when two flakerefs are equal, their
strings will also be equal. The docs for FlakeRef.String go into more
detail on what the normalized form looks like.

Being able to parse/modify/encode flake references is part of the work
to support multiple package outputs. Having a single (well-tested type)
for handling flakes should help manage the complexity as another syntax
for outputs is added.
Split flakeref paths before unescaping to properly handle encoded
slashes (%2F). Use `URL.String()` to ensure that unescaped characters
get re-escaped for `FlakeRef.URL`.
@gcurtis gcurtis requested review from mikeland73 and savil November 1, 2023 15:11
Base automatically changed from gcurtis/flakeref-string to main November 1, 2023 17:55
@gcurtis gcurtis merged commit 439f2c4 into main Nov 1, 2023
@gcurtis gcurtis deleted the gcurtis/flakeref-escapes branch November 1, 2023 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants