Custom cover: fix (#10513)

Somehow have overlooked in testing.
Closes #10512.
reviewable/pr10515/r1
hius07 11 months ago committed by GitHub
parent a8244ddd23
commit 1944f54aa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -358,10 +358,10 @@ function BookInfo:setCustomBookCover(file, book_props, metadata_updated_caller_c
if sidecar_file then
sidecar_dir = util.splitFilePathName(sidecar_file)
else -- no sdr folder, create new
sidecar_dir = DocSettings:getSidecarDir(file)
sidecar_dir = DocSettings:getSidecarDir(file) .. "/"
util.makePath(sidecar_dir)
end
local new_cover_file = sidecar_dir .. "/" .. "cover." .. util.getFileNameSuffix(image_file)
local new_cover_file = sidecar_dir .. "cover." .. util.getFileNameSuffix(image_file)
if ffiutil.copyFile(image_file, new_cover_file) == nil then
kvp_update()
end

@ -299,10 +299,13 @@ function DocSettings:flush(data, no_cover)
-- move cover file to the metadata file location
if not no_cover then
local cover_file = self:getCoverFile()
if cover_file and util.splitFilePathName(cover_file) ~= sidecar_dir then
ffiutil.copyFile(cover_file, sidecar_dir)
os.remove(cover_file)
self:getCoverFile(true) -- reset cache
if cover_file then
local filepath, filename = util.splitFilePathName(cover_file)
if filepath ~= sidecar_dir .. "/" then
ffiutil.copyFile(cover_file, sidecar_dir .. "/" .. filename)
os.remove(cover_file)
self:getCoverFile(true) -- reset cache
end
end
end

Loading…
Cancel
Save