datauris 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/lib/datauris/version.rb +1 -1
- data/lib/datauris.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89ab6159a9beb6750504017159f5d0e0391c78ea965aaea0d705531299bae7b1
|
4
|
+
data.tar.gz: 87bc327d253eb5464e47dbb2ef2d4770da2caacda008aac0ae8c8ad0b8f74483
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd984682f79f95f7170e023a4f1aa8a048339010e71ee984958c528a7c5bf7a8d6102d90398e636bf27c553cd88f38bae4417708ec6367e7ee713fe84b96620f
|
7
|
+
data.tar.gz: 0ebfd59f4ca9aa3ee881c5a5eab954d4ecd3691594418fc35b1709468d1012ede78139e180b47a700c25f796d8f2e827a1c76734b6aefb236f27e79fc5c0cf8d
|
data/CHANGELOG.md
CHANGED
data/lib/datauris/version.rb
CHANGED
data/lib/datauris.rb
CHANGED
@@ -172,8 +172,8 @@ module DataUri
|
|
172
172
|
## utf8 - or force utf8 encoding (utf8: true)
|
173
173
|
## uri - or force STOPPING uri encoding (uri: false)
|
174
174
|
def self.build( data, type=nil, base64: nil, utf8: nil, uri: nil )
|
175
|
-
|
176
|
-
|
175
|
+
str = "data:"
|
176
|
+
str += type if type ## note: allow optional / no type
|
177
177
|
|
178
178
|
## puts " type: #{type.inspect}, base64: #{base64.inspect}"
|
179
179
|
|
@@ -195,9 +195,9 @@ module DataUri
|
|
195
195
|
end
|
196
196
|
|
197
197
|
if base64
|
198
|
-
|
198
|
+
str += ";base64," + Base64.strict_encode64( data )
|
199
199
|
elsif utf8
|
200
|
-
|
200
|
+
str += ";utf8," + data
|
201
201
|
else
|
202
202
|
## use encode_uri_component by default - why? why not?
|
203
203
|
## space becomes %20
|
@@ -205,7 +205,7 @@ module DataUri
|
|
205
205
|
## , becomes %2C and so on
|
206
206
|
##
|
207
207
|
## note: use uri: false to turn of uri encode!!!
|
208
|
-
|
208
|
+
str += "," + (uri == false ? data : encode_uri( data ))
|
209
209
|
end
|
210
210
|
end
|
211
211
|
|