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

Add upload endpoint #533

Merged
merged 1 commit into from
Jul 26, 2022
Merged

Add upload endpoint #533

merged 1 commit into from
Jul 26, 2022

Conversation

atrawog
Copy link
Collaborator

@atrawog atrawog commented May 16, 2022

This PR adds the api endpoint /channels/{channel_name}/upload/{filename} to quetz. The new endpoint includes a mandatory sha256 checksum verification and uses an async request.stream that is calculating the sha256 checksum while uploading.

An example file upload for sqlite-3.37.2-hc67169a_0.tar.bz2 with curl using the new endpoint looks like this:

curl -i -H  "X-API-Key: ${QUETZ_API_KEY}" \
-X POST http://127.0.0.1:8000/api/channels/uptest/upload/sqlite-3.37.2-hc67169a_0.tar.bz2?sha256=63da44f64fb627ad144d38df48b24fb741f8f787027b38219273b40ac75bada9 \
--data-binary @sqlite-3.37.2-hc67169a_0.tar.bz2

@wolfv wolfv added the enhancement New feature or request label May 23, 2022
@wolfv
Copy link
Member

wolfv commented Jun 27, 2022

This looks good to me. The only modification I would like is to also expect either a Content-Length header or a ?size=... argument to have knowledge about the expected file size. While this doesn't give any additional guarantees vs. the hash, I think it could be quite useful to later e.g. abort an upload early if not enough space is available and so on.

@wolfv wolfv merged commit 1d2feb9 into mamba-org:main Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants