summaryrefslogtreecommitdiff
path: root/app/services/repository_archive_clean_up_service.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-04-25 08:22:43 +0000
committerMayra Cabrera <mcabrera@gitlab.com>2018-04-30 15:00:14 -0500
commit9cf4e4734192c7234a97f1a7f472eed3ce7a2448 (patch)
treece101a37bfc462c0c232c9f8cb89c67bda4c974b /app/services/repository_archive_clean_up_service.rb
parente71351d4f463715fccd80ddbcb4dade67e80f34b (diff)
downloadgitlab-ce-9cf4e4734192c7234a97f1a7f472eed3ce7a2448.tar.gz
Merge branch 'security-45689-fix-archive-cache-bug' into 'security-10-7'
Serve archive requests with the correct file in all cases (10.7) See merge request gitlab/gitlabhq!2376
Diffstat (limited to 'app/services/repository_archive_clean_up_service.rb')
-rw-r--r--app/services/repository_archive_clean_up_service.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/services/repository_archive_clean_up_service.rb b/app/services/repository_archive_clean_up_service.rb
index 9a88459b511..ba7be4b3f89 100644
--- a/app/services/repository_archive_clean_up_service.rb
+++ b/app/services/repository_archive_clean_up_service.rb
@@ -20,11 +20,12 @@ class RepositoryArchiveCleanUpService
private
def clean_up_old_archives
- run(%W(find #{path} -not -path #{path} -type f \( -name \*.tar -o -name \*.bz2 -o -name \*.tar.gz -o -name \*.zip \) -maxdepth 2 -mmin +#{mmin} -delete))
+ run(%W(find #{path} -mindepth 1 -maxdepth 3 -type f \( -name \*.tar -o -name \*.bz2 -o -name \*.tar.gz -o -name \*.zip \) -mmin +#{mmin} -delete))
end
def clean_up_empty_directories
- run(%W(find #{path} -not -path #{path} -type d -empty -name \*.git -maxdepth 1 -delete))
+ run(%W(find #{path} -mindepth 2 -maxdepth 2 -type d -empty -delete))
+ run(%W(find #{path} -mindepth 1 -maxdepth 1 -type d -empty -delete))
end
def run(cmd)