Fixes for parallel upload (coverfiles get individual temporary names)

Updated teststatus
This commit is contained in:
Ozzie Isaacs
2024-11-30 09:45:46 +01:00
parent 344c0c7bc3
commit d45ed1c921
5 changed files with 627 additions and 4448 deletions
+2 -2
View File
@@ -237,7 +237,7 @@ def pdf_preview(tmp_file_path, tmp_dir):
if use_generic_pdf_cover:
return None
try:
cover_file_name = os.path.join(os.path.dirname(tmp_file_path), "cover.jpg")
cover_file_name = tmp_file_path + ".jpg"
with Image() as img:
img.options["pdf:use-cropbox"] = "true"
img.read(filename=tmp_file_path + '[0]', resolution=150)
@@ -245,7 +245,7 @@ def pdf_preview(tmp_file_path, tmp_dir):
if img.alpha_channel:
img.alpha_channel = 'remove'
img.background_color = Color('white')
img.save(filename=os.path.join(tmp_dir, cover_file_name))
img.save(filename=cover_file_name)
return cover_file_name
except PolicyError as ex:
log.warning('Pdf extraction forbidden by Imagemagick policy: %s', ex)