rack-multipart_related 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,12 @@
|
|
1
1
|
module Rack
|
2
2
|
class MultipartRelated
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
if path =~ /\/rack-multipart_related-([\w\.\-]+)/
|
9
|
-
v = $1
|
10
|
-
break
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
if v.nil?
|
15
|
-
path = ::File.expand_path('../../../../.git', __FILE__)
|
16
|
-
if ::File.exists?(path)
|
17
|
-
require "step-up"
|
18
|
-
v = StepUp::Driver::Git.last_version
|
19
|
-
end
|
20
|
-
end
|
21
|
-
if v.nil?
|
22
|
-
VERSION = "0.0.0"
|
23
|
-
else
|
24
|
-
v.sub!(/^v/, '')
|
25
|
-
v.sub!(/\+\d*$/, '')
|
26
|
-
VERSION = v
|
3
|
+
version = nil
|
4
|
+
version = $1 if ::File.expand_path('../../..', __FILE__) =~ /\/rack-multipart_related-([\w\.\-]+)/
|
5
|
+
if version.nil? && ::File.exists?(::File.expand_path('../../../../.git', __FILE__))
|
6
|
+
require "step-up"
|
7
|
+
version = StepUp::Driver::Git.last_version
|
27
8
|
end
|
9
|
+
version = "0.0.0" if version.nil?
|
10
|
+
VERSION = version.gsub(/^v?([^\+]+)\+?\d*$/, '\1')
|
28
11
|
end
|
29
12
|
end
|
@@ -11,7 +11,7 @@ module Rack
|
|
11
11
|
def call(env)
|
12
12
|
content_type = env['CONTENT_TYPE']
|
13
13
|
|
14
|
-
if content_type =~ /^multipart\/related/
|
14
|
+
if content_type =~ /^multipart\/related/ni
|
15
15
|
|
16
16
|
start_part = content_type[/.* start=(?:"((?:\\.|[^\"])*)"|([^;\s]*))/ni, 1]
|
17
17
|
start_part_type = content_type[/.* type=(?:"((?:\\.|[^\"])*)"|([^;\s]*))/ni, 1]
|
@@ -48,7 +48,7 @@ module Rack
|
|
48
48
|
part_ref = data[/^cid:(.+)$/ni, 1]
|
49
49
|
|
50
50
|
if part_ref
|
51
|
-
data = get_attribute(original_params, part_ref)
|
51
|
+
data = get_attribute(original_params, part_ref)
|
52
52
|
end
|
53
53
|
elsif data.kind_of?(Array)
|
54
54
|
data.each_with_index do |value, index|
|
@@ -51,7 +51,13 @@ class MultipartRelatedTest < Test::Unit::TestCase
|
|
51
51
|
expected_request_form_hash_after_middleware = {
|
52
52
|
"user" => {
|
53
53
|
"name" => "Jhon",
|
54
|
-
"avatar" =>
|
54
|
+
"avatar" => {
|
55
|
+
:type => "image/png",
|
56
|
+
:filename =>"image.png",
|
57
|
+
:tempfile => imagefile,
|
58
|
+
:head => "Content-Type: image/gif\r\nContent-Disposition: inline; name=\"avatar_image\"; filename=\"image.png\"\r\n",
|
59
|
+
:name =>"avatar_image"
|
60
|
+
}
|
55
61
|
}
|
56
62
|
}
|
57
63
|
|
@@ -67,4 +73,4 @@ class MultipartRelatedTest < Test::Unit::TestCase
|
|
67
73
|
assert last_response.ok?
|
68
74
|
assert_equal last_request.env["rack.request.form_hash"], expected_request_form_hash_after_middleware
|
69
75
|
end
|
70
|
-
end
|
76
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-multipart_related
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lucas Fais
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-12-
|
19
|
+
date: 2010-12-27 00:00:00 -02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|