Skip to content

src/thumbnailer_shared.lua: hash remote URLs even if short #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/thumbnailer_shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ function Thumbnailer:get_thumbnail_template()
end

filename = filename:gsub('[^a-zA-Z0-9_.%-\' ]', '')
-- Hash overly long filenames (most likely URLs)
if #filename > thumbnailer_options.hash_filename_length then

-- Hash remote URLs
if filesize == 0 then
filename = sha1.hex(file_path)
-- Hash overly long filenames
elseif #filename > thumbnailer_options.hash_filename_length then
filename = sha1.hex(filename)
end

Expand Down