Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
f9cbb3e1
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f9cbb3e1
编写于
7月 23, 2019
作者:
R
Rafael França
提交者:
Rafael Mendonça França
7月 23, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Merge pull request #36642 from wagenet/fix-disk-service-host
Fix host for ActiveStorage DiskService
上级
7087f924
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
13 addition
and
3 deletion
+13
-3
activestorage/lib/active_storage/service/disk_service.rb
activestorage/lib/active_storage/service/disk_service.rb
+5
-1
activestorage/test/service/disk_service_test.rb
activestorage/test/service/disk_service_test.rb
+8
-2
未找到文件。
activestorage/lib/active_storage/service/disk_service.rb
浏览文件 @
f9cbb3e1
...
@@ -84,8 +84,12 @@ def url(key, expires_in:, filename:, disposition:, content_type:)
...
@@ -84,8 +84,12 @@ def url(key, expires_in:, filename:, disposition:, content_type:)
purpose: :blob_key
}
purpose: :blob_key
}
)
)
current_uri
=
URI
.
parse
(
current_host
)
generated_url
=
url_helpers
.
rails_disk_service_url
(
verified_key_with_expiration
,
generated_url
=
url_helpers
.
rails_disk_service_url
(
verified_key_with_expiration
,
host:
current_host
,
protocol:
current_uri
.
scheme
,
host:
current_uri
.
host
,
port:
current_uri
.
port
,
disposition:
content_disposition
,
disposition:
content_disposition
,
content_type:
content_type
,
content_type:
content_type
,
filename:
filename
filename:
filename
...
...
activestorage/test/service/disk_service_test.rb
浏览文件 @
f9cbb3e1
...
@@ -8,8 +8,14 @@ class ActiveStorage::Service::DiskServiceTest < ActiveSupport::TestCase
...
@@ -8,8 +8,14 @@ class ActiveStorage::Service::DiskServiceTest < ActiveSupport::TestCase
include
ActiveStorage
::
Service
::
SharedServiceTests
include
ActiveStorage
::
Service
::
SharedServiceTests
test
"URL generation"
do
test
"URL generation"
do
original_url_options
=
Rails
.
application
.
routes
.
default_url_options
.
dup
Rails
.
application
.
routes
.
default_url_options
.
merge!
(
protocol:
"http"
,
host:
"test.example.com"
,
port:
3001
)
begin
assert_match
(
/^https:\/\/example.com\/rails\/active_storage\/disk\/.*\/avatar\.png\?content_type=image%2Fpng&disposition=inline/
,
assert_match
(
/^https:\/\/example.com\/rails\/active_storage\/disk\/.*\/avatar\.png\?content_type=image%2Fpng&disposition=inline/
,
@service
.
url
(
@key
,
expires_in:
5
.
minutes
,
disposition: :inline
,
filename:
ActiveStorage
::
Filename
.
new
(
"avatar.png"
),
content_type:
"image/png"
))
@service
.
url
(
@key
,
expires_in:
5
.
minutes
,
disposition: :inline
,
filename:
ActiveStorage
::
Filename
.
new
(
"avatar.png"
),
content_type:
"image/png"
))
ensure
Rails
.
application
.
routes
.
default_url_options
=
original_url_options
end
end
end
test
"headers_for_direct_upload generation"
do
test
"headers_for_direct_upload generation"
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录