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
1bcd49f4
Commit
1bcd49f4
authored
Jul 18, 2013
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor DataUriAdapter a little
parent
38a6b4dc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
lib/paperclip/io_adapters/data_uri_adapter.rb
+5
-11
No files found.
lib/paperclip/io_adapters/data_uri_adapter.rb
View file @
1bcd49f4
...
...
@@ -3,9 +3,8 @@ module Paperclip
REGEXP
=
/^data:([-\w]+\/[-\w\+]+);base64,(.*)/
def
initialize
(
target
)
@data_uri_parts
=
target
.
match
(
REGEXP
)
||
[]
deserialize
def
initialize
(
target_uri
)
@target_uri
=
target_uri
cache_current_values
@tempfile
=
copy_to_tempfile
end
...
...
@@ -14,17 +13,12 @@ module Paperclip
def
cache_current_values
self
.
original_filename
=
'base64.txt'
@content_type
=
@data_uri_parts
[
1
]
@content_type
||=
'text/plain'
data_uri_parts
||=
@target_uri
.
match
(
REGEXP
)
||
[]
@content_type
=
data_uri_parts
[
1
]
||
'text/plain'
@target
=
StringIO
.
new
(
Base64
.
decode64
(
data_uri_parts
[
2
]
||
''
))
@size
=
@target
.
size
end
def
deserialize
@target
=
StringIO
.
new
(
Base64
.
decode64
(
@data_uri_parts
[
2
]))
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