From 448e2fe1a2126a690cf0ddd442cb8dc16a2167f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Wed, 4 Jul 2018 18:18:39 +0200 Subject: [PATCH] FIX: properly delete files in the download cache --- lib/file_store/base_store.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/file_store/base_store.rb b/lib/file_store/base_store.rb index aa602c2c79b..5523c4a2c82 100644 --- a/lib/file_store/base_store.rb +++ b/lib/file_store/base_store.rb @@ -128,10 +128,10 @@ module FileStore def cache_file(file, filename) path = get_cache_path_for(filename) dir = File.dirname(path) - FileUtils.mkdir_p(dir) unless Dir[dir].present? + FileUtils.mkdir_p(dir) unless Dir.exist?(dir) FileUtils.cp(file.path, path) # keep latest 500 files - `ls -tr #{CACHE_DIR} | head -n -#{CACHE_MAXIMUM_SIZE} | xargs rm -f` + `ls -tr #{CACHE_DIR} | head -n -#{CACHE_MAXIMUM_SIZE} | awk '$0="#{CACHE_DIR}"$0' | xargs rm -f` end private