获取 blob 表示的已签名的永久引用,并将其转换为到期服务 URL 以供下载。
警告:默认情况下,所有 Active Storage 控制器都是公开可访问的。生成的 URL 难以猜测,但设计为永久的。如果你的文件需要更高级别的保护,请考虑实现 经过身份验证的控制器。
方法
- S
实例公共方法
show() 链接
来源:show | 在 GitHub 上
# 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