Skip to content

Commit

Permalink
improve regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Floppy committed Jan 27, 2025
1 parent 3c86890 commit 9551558
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/models_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def destroy
private

def redirect_search
redirect_to new_follow_path(uri: params[:q]) if params[:q]&.match?(/(@|acct:)?(?<username>[a-z0-9\-_.]+)(?:@(?<domain>.*))/)
redirect_to new_follow_path(uri: params[:q]) if params[:q]&.match?(/(@|acct:)?([a-z0-9\-_.]+)@(.*)/)

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
user-provided value
may run slow on strings with many repetitions of '-'.
end

def generate_available_tag_list
Expand Down

0 comments on commit 9551558

Please sign in to comment.