From e0619c86021ab8962f2ca0e80a6da15524329247 Mon Sep 17 00:00:00 2001 From: Christian Baars Date: Sun, 25 Jun 2023 21:21:27 +0200 Subject: [PATCH] post_esp32.py: Allow renaming of files from URLs on the fly (#18965) --- pio-tools/post_esp32.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pio-tools/post_esp32.py b/pio-tools/post_esp32.py index 7e4208f70..9f8a2f637 100644 --- a/pio-tools/post_esp32.py +++ b/pio-tools/post_esp32.py @@ -70,9 +70,12 @@ def esp32_build_filesystem(fs_size): if "no_files" in file: continue if "http" and "://" in file: - response = requests.get(file) + response = requests.get(file.split(" ")[0]) if response.ok: target = join(filesystem_dir,file.split(os.path.sep)[-1]) + if len(file.split(" ")) > 1: + target = join(filesystem_dir,file.split(" ")[1]) + print("Renaming",(file.split(os.path.sep)[-1]).split(" ")[0],"to",file.split(" ")[1]) open(target, "wb").write(response.content) else: print("Failed to download: ",file)