Fix #416 - Generate random unique 14-byte (19 characters) shortcodes
for local attachments, use them in URLs. Check status privacy before redirecting to actual file.
This commit is contained in:
		@@ -10,6 +10,7 @@ class MediaController < ApplicationController
 | 
			
		||||
  private
 | 
			
		||||
 | 
			
		||||
  def set_media_attachment
 | 
			
		||||
    @media_attachment = MediaAttachment.where.not(status_id: nil).find(params[:id])
 | 
			
		||||
    @media_attachment = MediaAttachment.where.not(status_id: nil).find_by!(shortcode: params[:id])
 | 
			
		||||
    raise ActiveRecord::RecordNotFound unless @media_attachment.status.permitted?(current_account)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user