Skip to content

Commit fd4fd37

Browse files
committed
Auto merge of #13616 - ehuss:beta-fix-cdn-publish, r=weihanglo
[beta 1.78] Fix publish script due to crates.io CDN change This is a beta backport of #13614 to fix publishing in the next release.
2 parents 2fe739f + 54a60d0 commit fd4fd37

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

publish.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@
3131

3232

3333
def already_published(name, version):
34+
url = f'https://static.crates.io/crates/{name}/{version}/download'
3435
try:
35-
urllib.request.urlopen('https://crates.io/api/v1/crates/%s/%s/download' % (name, version))
36+
urllib.request.urlopen(url)
3637
except HTTPError as e:
37-
if e.code == 404:
38+
# 403 and 404 are common responses to assume it is not published
39+
if 400 <= e.code < 500:
3840
return False
41+
print(f'error: failed to check if {name} {version} is already published')
42+
print(f' HTTP response error code {e.code} checking {url}')
3943
raise
4044
return True
4145

0 commit comments

Comments
 (0)