Skip to content

resource-uri: Fix leading / in new - #1955

Open
Jakob-Naucke wants to merge 1 commit into
confidential-containers:mainfrom
Jakob-Naucke:fix-resource-uri-new
Open

Jakob-Naucke wants to merge 1 commit into
confidential-containers:mainfrom
Jakob-Naucke:fix-resource-uri-new

Conversation

@Jakob-Naucke

@Jakob-Naucke Jakob-Naucke commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

In #1486, ResourceUri::new was refactored, but it was missed that the elements of the split resource path start after the first split.

This leads to errors like illegal ResourceDesc format when used with trustee-attester because the URI will be rendered /kbs/v0/resource//a/b/c (notice the double slash).

Fix by taking from second character onward, and add a unit test.

In confidential-containers#1486, ResourceUri::new was refactored, but it was missed that the
elements of the split resource path start after the first split.

This leads to errors like `illegal ResourceDesc format` when used with
trustee-attester because the URI will be rendered
`/kbs/v0/resource//a/b/c` (notice the double slash).

Fix by taking from second character onward, and add a unit test.

Signed-off-by: Jakob Naucke <jnaucke@redhat.com>
@Jakob-Naucke
Jakob-Naucke requested a review from a team as a code owner December 4, 2026 20:00

@fitzthum fitzthum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. one nit.

maybe we should have some more tests for trustee-attester at some point

}

let segments: Vec<String> = resource_path.split('/').map(|s| s.to_string()).collect();
let path = &resource_path[1..];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be nicer to use strip_prefix here and you can probably combine that with the check above for the leading /.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants