Patch more missing thumbnail/screenshot change events, cache purges

This commit is contained in:
Kyle Drake 2020-01-27 18:56:43 -08:00
parent 2055ddc78b
commit b2b38b90b9
3 changed files with 35 additions and 9 deletions

View file

@ -61,6 +61,8 @@ class SiteFile < Sequel::Model
begin
FileUtils.mv site.files_path(path), site.files_path(new_path)
site.delete_thumbnail_or_screenshot current_path
site.generate_thumbnail_or_screenshot new_path
rescue Errno::ENOENT => e
return false, 'destination directory does not exist' if e.message =~ /No such file or directory/i
raise e
@ -80,8 +82,10 @@ class SiteFile < Sequel::Model
original_site_file_path = site_file.path
site_file.path = site_file.path.gsub(/^#{current_path}\//, "#{new_path}\/")
site_file.save_changes
site.purge_cache original_site_file_path
site.delete_thumbnail_or_screenshot original_site_file_path
site.generate_thumbnail_or_screenshot site_file.path
site.purge_cache site_file.path
site.purge_cache original_site_file_path
end
end
end