Skip to content

Commit 83bab98

Browse files
committed
fix(core_dl): fix zip extraction with extractsrc across devices and non-empty dirs
Using mv to move extracted directories fails in two cases: - Cross-device moves (e.g. tmp and serverfiles on different Docker volumes) - Target directory already exists and is non-empty (update scenario) Replace find+mv with cp -a which handles both cases by copying recursively and merging into the destination. Also replace the hardcoded 'Xonotic' temp_extractdir with ${extractsrc} to be generic.
1 parent 4770ff4 commit 83bab98

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lgsm/modules/core_dl.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ fn_dl_extract() {
267267
fi
268268
elif [ "${mime}" == "application/zip" ]; then
269269
if [ -n "${extractsrc}" ]; then
270-
temp_extractdir="${tmpdir}/Xonotic"
270+
temp_extractdir="${tmpdir}/${extractsrc}"
271271
extractcmd=$(unzip -qo "${local_filedir}/${local_filename}" "${extractsrc}/*" -d "${temp_extractdir}")
272-
find "${temp_extractdir}/${extractsrc}" -mindepth 1 -maxdepth 1 -exec mv -t "${extractdest}" {} +
272+
cp -a "${temp_extractdir}/${extractsrc}/." "${extractdest}/"
273273
rm -rf "${temp_extractdir}"
274274
else
275275
extractcmd=$(unzip -qo -d "${extractdest}" "${local_filedir}/${local_filename}")

0 commit comments

Comments
 (0)