WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 8a85930

Browse files
committed
ChatGPT failed, lets see Gemini Flash at work
1 parent bf181da commit 8a85930

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

apps/faf-legacy-deployment/scripts/deploy-coop.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,21 @@ def zipdir(path, ziph):
123123
dirs.sort() # deterministic order
124124
for file in files:
125125
full_path = os.path.join(root, file)
126-
arcname = os.path.relpath(full_path, start=path) # preserve folder structure
126+
# preserve folder structure
127+
arcname = os.path.relpath(full_path, start=base_dir)
127128
info = zipfile.ZipInfo(arcname, FIXED_ZIP_TIMESTAMP)
128129
with open(full_path, "rb") as f:
129130
data = f.read()
130131
ziph.writestr(info, data, compress_type=zipfile.ZIP_DEFLATED)
131132
else:
132133
# single file outside a directory
133-
arcname = os.path.basename(path)
134+
arcname = os.path.relpath(path, start=base_dir)
134135
info = zipfile.ZipInfo(arcname, FIXED_ZIP_TIMESTAMP)
135136
with open(path, "rb") as f:
136137
data = f.read()
137138
ziph.writestr(info, data, compress_type=zipfile.ZIP_DEFLATED)
138139

139140

140-
141141
def create_file(conn, mod, fileId, version, name, source, target_dir, old_md5, dryrun):
142142
"""Pack or copy files, compare MD5, update DB if changed."""
143143
target_dir = os.path.join(target_dir, f"updates_{mod}_files")
@@ -238,8 +238,12 @@ def download_vo_assets(version, target_dir):
238238

239239
# 1. Get latest release JSON from GitHub
240240
api_url = f"https://api.github.com/repos/FAForever/fa-coop/releases/tags/v{version}"
241-
with urllib.request.urlopen(api_url) as response:
242-
release_info = json.load(response)
241+
try:
242+
with urllib.request.urlopen(api_url) as response:
243+
release_info = json.load(response)
244+
except urllib.error.HTTPError as e:
245+
print(f"Failed to fetch release info: {e}")
246+
return
243247

244248
# 2. Filter assets ending with .nx2
245249
nx2_urls = [

0 commit comments

Comments
 (0)