fix(release): keep signed CI archive redirects on loopback
Gitea CI / Build Windows x64 app (pull_request) Successful in 5m56s
Gitea CI / Assemble and validate CI artifacts (pull_request) Successful in 53s
Gitea CI / Gitea CI passed (pull_request) Successful in 2s
Gitea CI / Check code and tests (pull_request) Successful in 5m49s
Gitea CI / Build Android APK (pull_request) Successful in 3m30s
Gitea CI / Audit and package Windows x64 (pull_request) Successful in 1m4s
Gitea CI / Build Windows x64 app (pull_request) Successful in 5m56s
Gitea CI / Assemble and validate CI artifacts (pull_request) Successful in 53s
Gitea CI / Gitea CI passed (pull_request) Successful in 2s
Gitea CI / Check code and tests (pull_request) Successful in 5m49s
Gitea CI / Build Android APK (pull_request) Successful in 3m30s
Gitea CI / Audit and package Windows x64 (pull_request) Successful in 1m4s
This commit is contained in:
1 parent
36b9fd9d21
commit
4346d9330a
3 files changed
+40
-1
No files matched your search
@@ -4,6 +4,7 @@ from concurrent.futures import ThreadPoolExecutor
|
||||
import http.client
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
import urllib.error
|
||||
@@ -55,8 +56,13 @@ def retry_read(operation):
|
||||
def request(url, data=None, method=None, content_type='application/json'):
|
||||
endpoint = transport_url(url)
|
||||
headers = {'Authorization': 'token ' + os.environ['GITEA_TOKEN']}
|
||||
if endpoint != url:
|
||||
local_archive = (data is None and method in (None, 'GET')
|
||||
and re.fullmatch(r'/api/v1/repos/[^/]+/[^/]+/actions/artifacts/\d+/zip',
|
||||
urllib.parse.urlparse(url).path))
|
||||
if endpoint != url and not local_archive:
|
||||
# Gitea constructs response links from Host, even when reached locally.
|
||||
# CI ZIP downloads redirect to a signed raw URL. Keep their local Host
|
||||
# so urllib follows that redirect locally instead of returning to FRP.
|
||||
headers['Host'] = 'git.orangraph.com'
|
||||
if data is not None:
|
||||
headers['Content-Type'] = content_type
|
||||
|
||||
Reference in new issue
Block a user