Fix loading world from compressed tar archives (#1304)

This commit is contained in:
Luc Ritchie
2022-01-25 17:19:15 -05:00
committed by GitHub
parent d02bbb798e
commit 8a42dfe232
14 changed files with 60 additions and 10 deletions

View File

@@ -195,12 +195,16 @@ function extract() {
destDir=${2?}
type=$(file -b --mime-type "${src}")
if [[ $type == application/zip ]]; then
unzip -q -d "${destDir}" "${src}"
elif [[ $type == application/x-tar ]]; then
tar -C "${destDir}" -xf "${src}"
else
log "ERROR: unsupported archive type: $type"
return 1
fi
}
case "${type}" in
application/zip)
unzip -q -d "${destDir}" "${src}"
;;
application/x-tar|application/gzip|application/x-bzip2|application/zstd)
tar -C "${destDir}" -xf "${src}"
;;
*)
log "ERROR: unsupported archive type: $type"
return 1
;;
esac
}