dont allow directories to end with .htm or .html. Breaks the dashboard UI, also breaks the cdn

This commit is contained in:
Kyle Drake 2024-03-13 16:57:54 -05:00
parent 9dbec11353
commit 88ad085ac8
2 changed files with 15 additions and 1 deletions

View file

@ -81,7 +81,12 @@ class SiteFile < Sequel::Model
return false, "#{is_directory ? 'directory' : 'file'} already exists"
end
unless is_directory
if is_directory
if new_path.match(/\.html?$/)
return false, 'directory name cannot end with .htm or .html'
end
else # a file
mime_type = Magic.guess_file_mime_type site.files_path(self.path)
extname = File.extname new_path