mirror of
https://github.com/akuker/RASCSI.git
synced 2025-02-26 09:29:16 +00:00
Unzip zipfiles before storing to iso (#525)
* Unzip zipfiles before storing to iso * Add helptext * Skip unzip for MacZip format * Should not be an fstring
This commit is contained in:
parent
39bc485671
commit
7efa895239
@ -242,6 +242,7 @@ def download_file_to_iso(url, *iso_args):
|
||||
"""
|
||||
from time import time
|
||||
from subprocess import run, CalledProcessError
|
||||
import asyncio
|
||||
|
||||
server_info = get_server_info()
|
||||
|
||||
@ -257,6 +258,25 @@ def download_file_to_iso(url, *iso_args):
|
||||
if not req_proc["status"]:
|
||||
return {"status": False, "msg": req_proc["msg"]}
|
||||
|
||||
from zipfile import is_zipfile, ZipFile
|
||||
if is_zipfile(tmp_full_path):
|
||||
if "XtraStuf.mac" in str(ZipFile(tmp_full_path).namelist()):
|
||||
logging.info("MacZip file format detected. Will not unzip to retain resource fork.")
|
||||
else:
|
||||
logging.info(
|
||||
"%s is a zipfile! Will attempt to unzip and store the resulting files.",
|
||||
tmp_full_path,
|
||||
)
|
||||
unzip_proc = asyncio.run(run_async(
|
||||
f"unzip -d {tmp_dir} -n {tmp_full_path}"
|
||||
))
|
||||
if not unzip_proc["returncode"]:
|
||||
logging.info(
|
||||
"%s was successfully unzipped. Deleting the zipfile.",
|
||||
tmp_full_path,
|
||||
)
|
||||
delete_file(tmp_full_path)
|
||||
|
||||
try:
|
||||
iso_proc = (
|
||||
run(
|
||||
@ -265,7 +285,7 @@ def download_file_to_iso(url, *iso_args):
|
||||
*iso_args,
|
||||
"-o",
|
||||
iso_filename,
|
||||
tmp_full_path,
|
||||
tmp_dir,
|
||||
],
|
||||
capture_output=True,
|
||||
check=True,
|
||||
|
@ -448,6 +448,7 @@
|
||||
<li>HFS is for Mac OS, Joliet for Windows, and Rock Ridge for POSIX.</li>
|
||||
<li>On Mac OS, requires a <a href="https://github.com/akuker/RASCSI/wiki/Drive-Setup#Mounting_CD_ISO_or_MO_images">compatible CD-ROM driver</a> installed on the target system.
|
||||
</li>
|
||||
<li>If the target file is a zip archive, we will attempt to unzip it and store the resulting files only.</li>
|
||||
</ul>
|
||||
</details>
|
||||
<table style="border: none">
|
||||
|
Loading…
x
Reference in New Issue
Block a user