Skip to content

Commit 5724279

Browse files
authored
OTWO-7467 Sanitize url when determining branch (#1826)
1 parent 6700449 commit 5724279

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

app/controllers/api/v1/projects_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ def create_code_location_subscription
7070
end
7171

7272
def code_location_branch(url)
73+
return unless url&.match(/^(https?|git)/)
74+
7375
out, _err, _status = Open3.capture3("git ls-remote --symref #{url} HEAD | head -1 | awk '{print $2}'")
7476
out.strip.sub(/refs\/heads\//, '')
7577
end

lib/tasks/cleanup_nginx_logs.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ desc 'Cleanup nginx logs'
44
task cleanup_nginx_logs: :environment do
55
log_file = '/var/log/nginx/openhub-access.log'
66

7-
File.open(log_file, 'w') {} if File.exist?(log_file)
7+
File.write(log_file, '') if File.exist?(log_file)
88
end

0 commit comments

Comments
 (0)