diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-13 15:59:47 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-13 15:59:47 +0200 |
commit | d8565cff0e2821834d78c222a31f6527af56860d (patch) | |
tree | 7cf7a6f703296be94a140fe3be79d2986f79d232 /lib/gitlab_shell.rb | |
parent | a0104118c89817ffdf88363180732d1d40cb284c (diff) | |
download | gitlab-shell-d8565cff0e2821834d78c222a31f6527af56860d.tar.gz |
Escape repository path
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib/gitlab_shell.rb')
-rw-r--r-- | lib/gitlab_shell.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb index c73bc29..65f7786 100644 --- a/lib/gitlab_shell.rb +++ b/lib/gitlab_shell.rb @@ -43,7 +43,7 @@ class GitlabShell def parse_cmd args = Shellwords.shellwords(@origin_cmd) @git_cmd = args[0] - @repo_name = args[1] + @repo_name = escape_path(args[1]) end def git_cmds @@ -86,4 +86,12 @@ class GitlabShell def log_username @config.audit_usernames ? username : "user with key #{@key_id}" end + + def escape_path(path) + if File.absolute_path(path, repos_path) == File.join(repos_path, path) + path + else + raise "Wrong repository path" + end + end end |