Skip to content

Escape resource IDs when appending to URLs - #156

Closed
Callum027 wants to merge 1 commit into
gnocchixyz:masterfrom
Callum027:escape-resource-ids
Closed

Callum027 wants to merge 1 commit into
gnocchixyz:masterfrom
Callum027:escape-resource-ids

Conversation

@Callum027

Copy link
Copy Markdown
Contributor

Ceilometer passes original resource IDs to many Gnocchi resource API functions, even if they are not UUIDs. Gnocchi allows this, but converts them to resource UUIDs based on the authenticated user and project.

Ceilometer publishes Swift containers to Gnocchi using IDs in the format {project_id}_{container_name}. Container names can be made up of any characters up to 256 characters long, including special characters such as the ones used in URL escapes.

To ensure such resource IDs are parsed by Gnocchi correctly, escape them using urllib.parse.quote before appending to URLs where required.

Ceilometer passes original resource IDs to many Gnocchi resource API functions, even if they are not UUIDs. Gnocchi allows this, but converts them to resource UUIDs based on the authenticated user and project.

Ceilometer publishes Swift containers to Gnocchi using IDs in the format `{project_id}_{container_name}`. Container names can be made up of any characters up to 256 characters long, including special characters such as the ones used in URL escapes.

To ensure such resource IDs are parsed by Gnocchi correctly, escape them using `urllib.parse.quote` before appending to URLs where required.
@Callum027

Copy link
Copy Markdown
Contributor Author

@tobias-urdin Looks like the pipeline needs some work.

@tobias-urdin

Copy link
Copy Markdown
Contributor

The CI will be fixed by #154 when merged.

@tobias-urdin

Copy link
Copy Markdown
Contributor

can you compare this PR to this one that I've missed #152 and see which one you prefer, seems to be the same issue

@Callum027

Copy link
Copy Markdown
Contributor Author

can you compare this PR to this one that I've missed #152 and see which one you prefer, seems to be the same issue

I have made comments on improvements that should be made to #152, but on the whole I prefer the solution of having a separate encoding method for resource_id and setting safe="" on urllib.parse.quote (though not for the reasons the contributor of #152 did).

If #152 does not get a timely response, I am happy to update my change to incorporate some of the improvements of that one.

@Callum027

Copy link
Copy Markdown
Contributor Author

Closed in favour of: #152

@Callum027 Callum027 closed this Oct 17, 2026
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