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

Storage pool used by is double url encoded #12398

Closed
edlerd opened this issue Oct 17, 2023 · 0 comments · Fixed by #12407
Closed

Storage pool used by is double url encoded #12398

edlerd opened this issue Oct 17, 2023 · 0 comments · Fixed by #12407
Assignees
Labels
Bug Confirmed to be a bug

Comments

@edlerd
Copy link
Contributor

edlerd commented Oct 17, 2023

Required information

  • Distribution: Ubuntu snap
  • Distribution version: 5.18-8eef740
    • Storage backend in use: directory

Issue description

In directory storage pools, non-ascii characters are allowed in custom volume names. The storage pools used_by section url encodes those names twice, resulting in broken urls.

Steps to reproduce

  1. Create a storage pool called dir with driver directory
  2. Create a custom storage volume in that pool and name it tüdeldü.
  3. Query the storage pool via API and look at the used_by section GET 1.0/storage-pools/dir (see screenshot below)

Screenshot from 2023-10-17 15-15-33

The returned url is

  • /1.0/storage-pools/dir/volumes/custom/t%25C3%25BCdeld%25C3%25BC

But the correct url is

  • 1.0/storage-pools/dir/volumes/custom/t%C3%BCdeld%C3%BC

Appearently the volume name is url encoded twice. It should only be encoded once.

tomponline added a commit to tomponline/lxd that referenced this issue 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 canonical#12398

Signed-off-by: Thomas Parrott <[email protected]>
tomponline added a commit to tomponline/lxd that referenced this issue 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 canonical#12398

Signed-off-by: Thomas Parrott <[email protected]>
@tomponline tomponline assigned tomponline and unassigned MusicDin Oct 18, 2023
@tomponline tomponline added the Bug Confirmed to be a bug label Oct 18, 2023
tomponline added a commit to tomponline/lxd that referenced this issue Dec 5, 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 canonical#12398

Signed-off-by: Thomas Parrott <[email protected]>
tomponline added a commit to tomponline/lxd that referenced this issue Dec 5, 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 canonical#12398

Signed-off-by: Thomas Parrott <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed to be a bug
Projects
None yet
3 participants