catch for missing file rename with libmagic check

This commit is contained in:
Kyle Drake 2025-06-13 14:49:22 -05:00
parent 1f7087cb7f
commit 1ab5f654b1

View file

@ -87,7 +87,12 @@ class SiteFile < Sequel::Model
end
else # a file
begin
mime_type = Magic.guess_file_mime_type site.files_path(self.path)
rescue Errno::ENOENT
return false, 'file to rename not found'
end
extname = File.extname new_path
unless site.supporter? || site.class.valid_file_mime_type_and_ext?(mime_type, extname)