Skip to content

pkg/chartmuseum/server/multitenant: remove stored files from the right path on failed uploads - #1162

Merged
scbizu merged 1 commit into
helm:mainfrom
vignesh2027:fix/post-chart-prov-rollback-path
Nov 26, 2026
Merged

scbizu merged 1 commit into
helm:mainfrom
vignesh2027:fix/post-chart-prov-rollback-path

Conversation

@vignesh2027

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

When a multipart upload carries a chart and a provenance file and storing the second file fails, the handler removes the file it already saved. It called DeleteObject with the bare file name, but the files are stored under the repo prefix, so with a repo in the URL the delete pointed at a path that does not exist.

The first file then stayed in storage without ever reaching the index, and uploading the chart again was answered with a 409 because the file already existed. This deletes the object under repo/filename. It also logs the chart parse error there instead of err, which is always nil at that point.

I added a test with a storage backend that fails the second PutObject. It uploads to a depth 1 repo, checks that nothing is left behind and that a retry returns 201. On main the leftover file is there and the retry gets 409.

…t path on failed uploads

When a multipart upload with a chart and a provenance file fails while
storing the second file, the handler tries to remove the first one. It
passed only the bare file name to DeleteObject, but the files are stored
under the repo prefix, so with a repo in the URL the delete hit a path
that does not exist. The chart stayed in storage without being indexed,
and uploading it again was answered with a conflict.

Delete the object under its repo path, and log the chart parse error
instead of the always nil upload error.

Signed-off-by: vigneshwar <applemacbook6sep2004@gmail.com>
@scbizu

scbizu commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

LGTM

@scbizu
scbizu merged commit bc6f581 into helm:main Nov 26, 2026
2 checks passed
@vignesh2027

Copy link
Copy Markdown
Contributor Author

Thanks a lot for taking this in. It was a small path mix up, but on a multitenant setup it would quietly leave orphaned chart files behind after a failed upload, so I am glad it is fixed.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants