Skip to content

Commit

Permalink
Support SHA256 hashes
Browse files Browse the repository at this point in the history
This is needed by GitLab to support uploads from flit (GitLab works fine
with twine).

Addresses #364 of takluyver/flit
Addresses #333964 of gitlab.com/gitlab-org/gitlab

The most useful one-line of code I ever wrote I believe.
  • Loading branch information
Matcha @sennder committed Jul 2, 2021
1 parent b944ecc commit 10e3145
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions flit/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 226,7 @@ def upload_file(file:Path, metadata:Metadata, repo):
content = f.read()
files = {'content': (file.name, content)}
data['md5_digest'] = hashlib.md5(content).hexdigest()
data['sha256_digest'] = hashlib.sha256(content).hexdigest()

log.info('Uploading %s...', file)
resp = requests.post(repo['url'],
Expand Down

0 comments on commit 10e3145

Please sign in to comment.