about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-07-20 17:06:52 +0200
committerGitHub <noreply@github.com>2022-07-20 17:06:52 +0200
commit726931fe4a8202c64fd1a72a6043f80fe075fda7 (patch)
tree4feca23012d195c70a287fde9b852500dbaef2aa /app/controllers
parentf8b3e3692932ddfd69bc0a631256ac78411e818a (diff)
Fix /api/v1/tags/:id route constraints (#18854)
The constraint was applied prior to decoding, and rejected anything containing
the '%' character, which would be used for anything with non-ASCII unicode
characters.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/v1/tags_controller.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/controllers/api/v1/tags_controller.rb b/app/controllers/api/v1/tags_controller.rb
index d45015ff5..9e5c53330 100644
--- a/app/controllers/api/v1/tags_controller.rb
+++ b/app/controllers/api/v1/tags_controller.rb
@@ -24,6 +24,7 @@ class Api::V1::TagsController < Api::BaseController
   private
 
   def set_or_create_tag
+    return not_found unless /\A(#{Tag::HASHTAG_NAME_RE})\z/.match?(params[:id])
     @tag = Tag.find_normalized(params[:id]) || Tag.new(name: Tag.normalize(params[:id]), display_name: params[:id])
   end
 end