Fix #3500: Redirect API endpoints with md5 query param to correct format.
This commit is contained in:
@@ -6,7 +6,9 @@ class PostsController < ApplicationController
|
|||||||
def index
|
def index
|
||||||
if params[:md5].present?
|
if params[:md5].present?
|
||||||
@post = Post.find_by_md5(params[:md5])
|
@post = Post.find_by_md5(params[:md5])
|
||||||
redirect_to post_path(@post)
|
respond_with(@post) do |format|
|
||||||
|
format.html { redirect_to(@post) }
|
||||||
|
end
|
||||||
else
|
else
|
||||||
limit = params[:limit] || (params[:tags] =~ /(?:^|\s)limit:(\d+)(?:$|\s)/ && $1) || CurrentUser.user.per_page
|
limit = params[:limit] || (params[:tags] =~ /(?:^|\s)limit:(\d+)(?:$|\s)/ && $1) || CurrentUser.user.per_page
|
||||||
@random = params[:random] || params[:tags] =~ /(?:^|\s)order:random(?:$|\s)/
|
@random = params[:random] || params[:tags] =~ /(?:^|\s)order:random(?:$|\s)/
|
||||||
|
|||||||
Reference in New Issue
Block a user