Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
ff48f688
Commit
ff48f688
authored
Nov 16, 2011
by
Mike Burns
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'question_mark_files' of
https://github.com/xxx/paperclip
parents
b09b05b4
11a09fbf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
2 deletions
+42
-2
test/fixtures/question?mark.png
+0
-0
test/helper.rb
+2
-0
test/storage/s3_live_test.rb
+40
-2
No files found.
test/fixtures/question?mark.png
0 → 100644
View file @
ff48f688
1.58 KB
test/helper.rb
View file @
ff48f688
...
...
@@ -12,6 +12,8 @@ require 'active_support'
require
'mime/types'
require
'pathname'
require
'pathname'
puts
"Testing against version
#{
ActiveRecord
::
VERSION
::
STRING
}
"
`ruby -e 'exit 0'`
# Prime $? with a value.
...
...
test/storage/s3_live_test.rb
View file @
ff48f688
...
...
@@ -9,7 +9,7 @@ unless ENV["S3_TEST_BUCKET"].blank?
:storage
=>
:s3
,
:bucket
=>
ENV
[
"S3_TEST_BUCKET"
],
:path
=>
":class/:attachment/:id/:style.:extension"
,
:s3_credentials
=>
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
".."
,
"s3.yml"
))
:s3_credentials
=>
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
".."
,
"
fixtures"
,
"
s3.yml"
))
Dummy
.
delete_all
@dummy
=
Dummy
.
new
...
...
@@ -56,7 +56,7 @@ unless ENV["S3_TEST_BUCKET"].blank?
rebuild_model
:styles
=>
{
:thumb
=>
"100x100"
,
:square
=>
"32x32#"
},
:storage
=>
:s3
,
:bucket
=>
ENV
[
"S3_TEST_BUCKET"
],
:s3_credentials
=>
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
".."
,
"s3.yml"
))
:s3_credentials
=>
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
".."
,
"
fixtures"
,
"
s3.yml"
))
Dummy
.
delete_all
@dummy
=
Dummy
.
new
...
...
@@ -84,5 +84,43 @@ unless ENV["S3_TEST_BUCKET"].blank?
assert_match
/404 Not Found/
,
`curl -I
#{
url
}
`
end
end
context
"An attachment that uses S3 for storage and has a question mark in file name"
do
setup
do
rebuild_model
:styles
=>
{
:thumb
=>
"100x100"
,
:square
=>
"32x32#"
},
:storage
=>
:s3
,
:bucket
=>
ENV
[
"S3_TEST_BUCKET"
],
:s3_credentials
=>
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
".."
,
"fixtures"
,
"s3.yml"
))
Dummy
.
delete_all
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'fixtures'
,
'question?mark.png'
),
'rb'
)
@dummy
.
save
end
teardown
{
@dummy
.
destroy
}
should
"return an unescaped version for path"
do
assert_match
/.+\/question\?mark\.png/
,
@dummy
.
avatar
.
path
end
# should "return an escaped version for url" do
# assert_match /.+\/question%3Fmark\.png/, @dummy.avatar.url
# end
should
"be accessible"
do
assert_match
/200 OK/
,
`curl -I "
#{
@dummy
.
avatar
.
url
}
"`
end
should
"be accessible with an expiring url"
do
assert_match
/200 OK/
,
`curl -I "
#{
@dummy
.
avatar
.
expiring_url
}
"`
end
should
"be destroyable"
do
url
=
@dummy
.
avatar
.
url
@dummy
.
destroy
assert_match
/404 Not Found/
,
`curl -I "
#{
url
}
"`
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment