mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:21:18 +08:00
Fix onebox loading on every keystroke after a request fails.
This commit is contained in:
@ -4,7 +4,16 @@ class OneboxController < ApplicationController
|
||||
|
||||
def show
|
||||
Oneboxer.invalidate(params[:url]) if params[:refresh].present?
|
||||
render text: Oneboxer.preview(params[:url])
|
||||
|
||||
result = Oneboxer.preview(params[:url])
|
||||
result.strip! if result.present?
|
||||
|
||||
# If there is no result, return a 404
|
||||
if result.blank?
|
||||
render nothing: true, status: 404
|
||||
else
|
||||
render text: result
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user