mirror of
https://github.com/neocities/neocities.git
synced 2025-07-03 01:23:22 +02:00
catch for missing file rename with libmagic check
This commit is contained in:
parent
1f7087cb7f
commit
1ab5f654b1
1 changed files with 6 additions and 1 deletions
|
@ -87,7 +87,12 @@ class SiteFile < Sequel::Model
|
||||||
end
|
end
|
||||||
|
|
||||||
else # a file
|
else # a file
|
||||||
mime_type = Magic.guess_file_mime_type site.files_path(self.path)
|
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
|
extname = File.extname new_path
|
||||||
|
|
||||||
unless site.supporter? || site.class.valid_file_mime_type_and_ext?(mime_type, extname)
|
unless site.supporter? || site.class.valid_file_mime_type_and_ext?(mime_type, extname)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue