跳至内容 跳至搜索

获取一个 blob 表示的已签名的永久引用,并将其转换为用于下载的过期服务 URL。

警告:默认情况下,所有 Active Storage 控制器都是公共可访问的。生成的 URL 难以猜测,但按设计是永久的。如果您的文件需要更高水平的保护,请考虑实现 身份验证控制器

方法
S

实例公共方法

show()

# File activestorage/app/controllers/active_storage/representations/redirect_controller.rb, line 10
def show
  expires_in ActiveStorage.service_urls_expire_in
  redirect_to @representation.url(disposition: params[:disposition]), allow_other_host: true
end