From 47a5d3cd02dc5cc86d3d4292f86cfe3e03c4e248 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Wed, 13 Jul 2022 02:44:30 -0500 Subject: [PATCH] Use copy/unlink instead of rename when generating bulk downloads --- scripts/generate-bulk-downloads | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/generate-bulk-downloads b/scripts/generate-bulk-downloads index 567a91fd..b8a765ab 100755 --- a/scripts/generate-bulk-downloads +++ b/scripts/generate-bulk-downloads @@ -75,7 +75,10 @@ function CreateZip(string $filePath, array $ebooks, string $type, string $webRoo $zip->close(); - rename($tempFilename, $filePath); + // We have to do a copy, then unlink because rename() can't rename across file systems. + // If the bulk downloads are symlinked to a storage volume, the rename() won't work. + copy($tempFilename, $filePath); + unlink($tempFilename); exec('attr -q -s se-ebook-type -V ' . escapeshellarg($type) . ' ' . escapeshellarg($filePath)); }