Skip to content

Commit 01f1ddd

Browse files
committed
fix(questionnaire): fixed hakiri error with vcs link regex
1 parent fadf50b commit 01f1ddd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

app/models/questionnaire.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ class Questionnaire < ApplicationRecord
4343

4444
validates :portfolio_url, url: { allow_blank: true }
4545
validates :vcs_url, url: { allow_blank: true }
46-
validates_format_of :vcs_url, with: %r{\A((github.com\/\w+\/?)|(gitlab.com\/\w+\/?)|(bitbucket.org\/\w+\/?))\z}, allow_blank: true, message: "Must be a GitHub, GitLab or Bitbucket url"
47-
46+
validates_format_of :vcs_url, with: /\A(((https?:\/\/)?(www\.)?github\.com\/\w+\/?)|((https?:\/\/)?(www\.)?gitlab\.com\/\w+\/?)|((https?:\/\/)?(www\.)?bitbucket\.org\/\w+\/?))\z/, allow_blank: true, message: "Must be a GitHub, GitLab or Bitbucket url"
4847
strip_attributes
4948

5049
POSSIBLE_EXPERIENCES = {
@@ -135,7 +134,7 @@ def portfolio_url=(value)
135134
end
136135

137136
def vcs_url=(value)
138-
value = "http://" + value if !value.blank? && !value.include?("http://") && !value.include?("https://")
137+
value = "https://" + value if !value.blank? && !value.include?("http://") && !value.include?("https://")
139138
super value
140139
end
141140

0 commit comments

Comments
 (0)