ScreenSaver: Don't expand special tokens with an empty string (#7314)

reviewable/pr7321/r1
NiLuJe 3 years ago committed by GitHub
parent 995668ac02
commit 467264f59f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -521,9 +521,9 @@ function Screensaver:expandSpecial(message, fallback)
currentpage = Math.round(percent * totalpages) currentpage = Math.round(percent * totalpages)
percent = Math.round(percent * 100) percent = Math.round(percent * 100)
if docinfo.data.doc_props then if docinfo.data.doc_props then
title = docinfo.data.doc_props.title or title title = docinfo.data.doc_props.title and docinfo.data.doc_props.title ~= "" and docinfo.data.doc_props.title or title
authors = docinfo.data.doc_props.authors or authors authors = docinfo.data.doc_props.authors and docinfo.data.doc_props.authors ~= "" and docinfo.data.doc_props.authors or authors
series = docinfo.data.doc_props.series or series series = docinfo.data.doc_props.series and docinfo.data.doc_props.series ~= "" and docinfo.data.doc_props.series or series
end end
docinfo:close() docinfo:close()
elseif instance ~= nil and lfs.attributes(lastfile, "mode") == "file" then elseif instance ~= nil and lfs.attributes(lastfile, "mode") == "file" then
@ -534,9 +534,9 @@ function Screensaver:expandSpecial(message, fallback)
percent = Math.round((currentpage * 100) / totalpages) percent = Math.round((currentpage * 100) / totalpages)
local props = doc:getProps() local props = doc:getProps()
if props then if props then
title = props.title or title title = props.title and props.title ~= "" and props.title or title
authors = props.authors or authors authors = props.authors and props.authors ~= "" and props.authors or authors
series = props.series or series series = props.series and props.series ~= "" and props.series or series
end end
doc:close() doc:close()
end end

Loading…
Cancel
Save