fix: prevent PDF out-of-range error message from overlapping preview image

This commit is contained in:
boydaihungst 2025-08-16 22:26:36 +07:00 committed by sxyazi
parent 3ca33c1f84
commit 207cfa9829
No known key found for this signature in database

View file

@ -51,6 +51,7 @@ function M:preload(job)
local pages = tonumber(output.stderr:match("the last page %((%d+)%)")) or 0
if job.skip > 0 and pages > 0 then
ya.emit("peek", { math.max(0, pages - 1), only_if = job.file.url, upper_bound = true })
return false
end
return true, Err("Failed to convert PDF to image, stderr: %s", output.stderr)
end