A platform for community discussion. Free, open, simple.
FIX: don't generate an exception when trying to cleanup unexisting tmp letter avatars
Régis Hanolf10af7e44939
diff --git a/lib/letter_avatar.rb b/lib/letter_avatar.rbindex 93766c4b2d1..cad64a83c5f 100644--- a/lib/letter_avatar.rb+++ b/lib/letter_avatar.rb@@ -105,12 +105,16 @@ class LetterAvatarenddef cleanup_old- skip = File.basename(cache_path)- parent_path = File.dirname(cache_path)- Dir.entries(parent_path).each do |path|- unless ['.', '..'].include?(path) || path == skip- FileUtils.rm_rf(parent_path + "/" + path)+ begin+ skip = File.basename(cache_path)+ parent_path = File.dirname(cache_path)+ Dir.entries(parent_path).each do |path|+ unless ['.', '..'].include?(path) || path == skip+ FileUtils.rm_rf(parent_path + "/" + path)+ endend+ rescue Errno::ENOENT+ # no worries, folder doesn't existsendendend