summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMark Fletcher <mark@gitlab.com>2017-02-28 21:01:55 +0530
committerMark Fletcher <mark@gitlab.com>2017-03-02 10:30:24 +0530
commit3ac54d22b940f781c4b870a9d8823a96ad117a53 (patch)
treeb8f16f381e1e2ffe0a83b2a57aa5de6d09b94589 /lib
parent7733f285aca97d444382a59eda0ea3e303539c26 (diff)
downloadgitlab-ce-3ac54d22b940f781c4b870a9d8823a96ad117a53.tar.gz
Ensure archive download is only one directory deep
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/git/repository.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 8ec90885231..f9904a39ca4 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -199,13 +199,17 @@ module Gitlab
nil
end
+ def archive_prefix(ref, sha)
+ project_name = self.name.chomp('.git')
+ "#{project_name}-#{ref.parameterize}-#{sha}"
+ end
+
def archive_metadata(ref, storage_path, format = "tar.gz")
ref ||= root_ref
commit = Gitlab::Git::Commit.find(self, ref)
return {} if commit.nil?
- project_name = self.name.chomp('.git')
- prefix = "#{project_name}-#{ref}-#{commit.id}"
+ prefix = archive_prefix(ref, commit.id)
{
'RepoPath' => path,