Skip to content

Commit

Permalink
Merge pull request #1320 from alphagov/update-regex-codeql-alert
Browse files Browse the repository at this point in the history
Improve URL regex match
  • Loading branch information
MahmudH authored Apr 8, 2024
2 parents c98d091 + bbb680f commit e60b9ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/presenters/scope_filters_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def normalize_path(path_or_url)
normalized_path = URI.parse(path_or_url).path

if normalized_path.present?
normalized_path.sub!(/^(http(s)?(:)?(\/)+?(:)?)?((\/)?www.)?gov.uk/, "")
normalized_path.sub!(/\A(http(s)?(:)?(\/)+?(:)?)?((\/)?www\.)?gov\.uk/, "")
normalized_path.start_with?("/") ? normalized_path : "/#{normalized_path}"
else
"/"
Expand Down

0 comments on commit e60b9ec

Please sign in to comment.