闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
434 B

  1. # frozen_string_literal: true
  2. class MediaController < ApplicationController
  3. before_action :set_media_attachment
  4. def show
  5. redirect_to @media_attachment.file.url(:original)
  6. end
  7. private
  8. def set_media_attachment
  9. @media_attachment = MediaAttachment.where.not(status_id: nil).find_by!(shortcode: params[:id])
  10. raise ActiveRecord::RecordNotFound unless @media_attachment.status.permitted?(current_account)
  11. end
  12. end