Skip to content

fix: 500 on bad url #466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/git_remote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
# Only allow safe protocols
return false unless repo_url.match?(/\A(https?|git|ssh):\/\//)

safe_repo_url = URI.parse(repo_url).to_s.gsub(" ", "").gsub("'", "")
Open3.capture2e("git", "ls-remote", safe_repo_url).last.success?
safe_repo_url = URI.parse(repo_url).to_s.gsub(" ", "").gsub("'", "") rescue (return false)

Check failure on line 12 in lib/git_remote.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/TrailingWhitespace: Trailing whitespace detected.
Open3.capture2e(
{"GIT_CURL_TIMEOUT"=>"15","GIT_HTTP_LOW_SPEED_LIMIT"=>"1000","GIT_HTTP_LOW_SPEED_TIME"=>"15","GIT_HTTP_MAX_REQUESTS"=>"5"},

Check failure on line 14 in lib/git_remote.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideHashLiteralBraces: Space inside } missing.

Check failure on line 14 in lib/git_remote.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceAfterComma: Space missing after comma.

Check failure on line 14 in lib/git_remote.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceAfterComma: Space missing after comma.

Check failure on line 14 in lib/git_remote.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceAfterComma: Space missing after comma.

Check failure on line 14 in lib/git_remote.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
"git","ls-remote","--",safe_repo_url

Check failure on line 15 in lib/git_remote.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceAfterComma: Space missing after comma.

Check failure on line 15 in lib/git_remote.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceAfterComma: Space missing after comma.

Check failure on line 15 in lib/git_remote.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceAfterComma: Space missing after comma.
).last.success?
end
end
Loading