mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
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.
This commit is contained in:
parent
f8b3e36929
commit
726931fe4a
@ -24,6 +24,7 @@ class Api::V1::TagsController < Api::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def set_or_create_tag
|
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])
|
@tag = Tag.find_normalized(params[:id]) || Tag.new(name: Tag.normalize(params[:id]), display_name: params[:id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -530,7 +530,7 @@ Rails.application.routes.draw do
|
|||||||
resource :note, only: :create, controller: 'accounts/notes'
|
resource :note, only: :create, controller: 'accounts/notes'
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :tags, only: [:show], constraints: { id: /#{Tag::HASHTAG_NAME_RE}/ } do
|
resources :tags, only: [:show] do
|
||||||
member do
|
member do
|
||||||
post :follow
|
post :follow
|
||||||
post :unfollow
|
post :unfollow
|
||||||
|
Loading…
Reference in New Issue
Block a user