Please CodeClimate
This commit is contained in:
parent
3ad653c4fd
commit
351629dedf
|
@ -28,13 +28,11 @@ class MediaController < ApplicationController
|
|||
|
||||
def set_media_attachment
|
||||
id = params[:id] || params[:medium_id]
|
||||
if id.nil?
|
||||
return
|
||||
elsif id.size == 19 # SecureRandom.url_safe(14)
|
||||
@media_attachment = MediaAttachment.local.attached.find_by!(shortcode: id)
|
||||
else
|
||||
@media_attachment = MediaAttachment.local.attached.find_by!(id: id)
|
||||
end
|
||||
return if id.nil?
|
||||
|
||||
scope = MediaAttachment.local.attached
|
||||
# If id is 19 characters long, it's a shortcode, otherwise it's an identifier
|
||||
@media_attachment = id.size == 19 ? scope.find_by!(shortcode: id) : scope.find_by!(id: id)
|
||||
end
|
||||
|
||||
def verify_permitted_status!
|
||||
|
|
Reference in New Issue