Skip to content
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

shared/api/url: Fix double path encoding issue #12407

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

tomponline
Copy link
Member

@tomponline tomponline commented Oct 18, 2023

Go's net.URL requires Path to be populated with unencoded path and RawPath to be populated with the hint on how we want Path to be encoded.

This avoids double path encoding when calling url.EscapedPath(), which is used in url.String().

Fixes #12398

Before:

lxc storage volume create default tüdeldü
lxc storage show default
config:
  source: /var/lib/lxd/storage-pools/default
description: ""
name: default
driver: dir
used_by:
- /1.0/storage-pools/default/volumes/custom/t%25C3%25BCdeld%25C3%25BC

After:

lxc storage show default
config:
  source: /var/lib/lxd/storage-pools/default
description: ""
name: default
driver: dir
used_by:
- /1.0/storage-pools/default/volumes/custom/t%C3%BCdeld%C3%BC

Closes #12406

Go's net.URL requires Path to be populated with unencoded path and
RawPath to be populated with the hint on how we want Path to be
encoded.

This avoids double path encoding when calling url.EscapedPath(),
which is used in url.String().

Fixes canonical#12398

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
@github-actions github-actions bot added the API Changes to the REST API label Oct 18, 2023
@tomponline tomponline merged commit ca197ee into canonical:main Oct 18, 2023
26 checks passed
@tomponline tomponline deleted the tp-url-encoded branch October 18, 2023 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Changes to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Storage pool used by is double url encoded
2 participants