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
dfd73b3e
Commit
dfd73b3e
authored
9 years ago
by
Piotr Szal
Committed by
Tute Costa
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Saving images from url with special characters #1921
[fixes #1932]
parent
0675822e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletions
+14
-1
NEWS
+1
-0
lib/paperclip/io_adapters/http_url_proxy_adapter.rb
+1
-1
spec/paperclip/io_adapters/http_url_proxy_adapter_spec.rb
+12
-0
No files found.
NEWS
View file @
dfd73b3e
...
...
@@ -4,6 +4,7 @@
* Bugfix: Dynamic fog directory option is now respected
* Bugfix: Fixes cocaine duplicated paths [#2169]
* Bugfix: Now it's possible to save images from URLs with special characters [#1932]
* Removal of dead code (older versions of Rails and AWS SDK)
* README adjustments
...
...
This diff is collapsed.
Click to expand it.
lib/paperclip/io_adapters/http_url_proxy_adapter.rb
View file @
dfd73b3e
...
...
@@ -4,7 +4,7 @@ module Paperclip
REGEXP
=
/\Ahttps?:\/\//
def
initialize
(
target
)
super
(
URI
(
target
))
super
(
URI
(
URI
.
escape
(
target
)
))
end
end
...
...
This diff is collapsed.
Click to expand it.
spec/paperclip/io_adapters/http_url_proxy_adapter_spec.rb
View file @
dfd73b3e
...
...
@@ -98,4 +98,16 @@ describe Paperclip::HttpUrlProxyAdapter do
end
end
context
"a url with special characters in the filename"
do
it
"returns a encoded filename"
do
Paperclip
::
HttpUrlProxyAdapter
.
any_instance
.
stubs
(
:download_content
).
returns
(
StringIO
.
new
(
"x"
))
url
=
"https://github.com/thoughtbot/paperclip-öäü字´½♥زÈ.png"
subject
=
Paperclip
.
io_adapters
.
for
(
url
)
filename
=
"paperclip-%C3%B6%C3%A4%C3%BC%E5%AD%97%C2%B4%C2%BD%E2%99%A5"
\
"%C3%98%C2%B2%C3%88.png"
assert_equal
filename
,
subject
.
original_filename
end
end
end
This diff is collapsed.
Click to expand it.
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