Skip to content

Commit 8d52879

Browse files
authored
Fix base64 encoding (#277)
base64 encoding in `wheel.utils` strips `=` padding. the same shalle be done.
1 parent ebaac3c commit 8d52879

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

auditwheel/wheeltools.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,17 @@ def skip(path):
7676
for path in walk():
7777
relative_path = relpath(path, bdist_dir)
7878
if skip(relative_path):
79-
hash = ''
79+
hash_ = ''
8080
size = ''
8181
else:
8282
with open(path, 'rb') as f:
8383
data = f.read()
8484
digest = hashlib.sha256(data).digest()
85-
hash = 'sha256=' + urlsafe_b64encode(digest).decode('ascii')
85+
sha256 = urlsafe_b64encode(digest).rstrip(b'=').decode('ascii')
86+
hash_ = f'sha256={sha256}'
8687
size = len(data)
8788
record_path = relpath(path, bdist_dir).replace(psep, '/')
88-
writer.writerow((record_path, hash, size))
89+
writer.writerow((record_path, hash_, size))
8990

9091

9192
class InWheel(InTemporaryDirectory):

0 commit comments

Comments
 (0)