egalite 1.5.6 → 1.5.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db514bb6d9faeb6cfabbca789a9a763836dc3632
4
- data.tar.gz: 38c947f91c01a9af375e5483c82ef85692b08c13
3
+ metadata.gz: ff679c4cc86d040ffff1b99eece4345dbcb7e14b
4
+ data.tar.gz: eb38d4be75ca4ef7286475c463545730eb7aca23
5
5
  SHA512:
6
- metadata.gz: 2f17b9cbf57d51b09832e288b388a1344cc0a51ed48fa6c614922da74142df8baf03b9dd431049553021bbb0552b8de30d8375a3143830849cdffd753cb581da
7
- data.tar.gz: 8b7099b961b735179af768fe91a6612fa3fdbb0960c3638f1cdd7e19810c66373c0b2e20cdaafd6722cd52e1229a9c18f2f6950e8b7d723bbbf8d81992e040db
6
+ metadata.gz: 485370a3ba61cdefe26f916dcda1f1d256069bfd0731f63a48ff5292081cfeff4f0bf45195792ae28b869c6a3f71511bbeb2881d0d3b6de85366dc3fbec88220
7
+ data.tar.gz: e61a71a1f480f802f68353d016f7960de036312e70e68d0cd9feb477c23fa2523738fd9791af82c73a5348d0ef3fcc15fd423d1b0d37276ecb6f4cdfa0424451
@@ -254,6 +254,7 @@ module Sendmail
254
254
  def send_with_uploaded_files(body, files, params, host = 'localhost')
255
255
  # files should be Rack uploaded files.
256
256
  sum_size = 0
257
+ files = [files].flatten
257
258
  parts = [mime_part(body)]
258
259
  parts += files.map { |f|
259
260
  binary = f[:tempfile].read
@@ -1,3 +1,3 @@
1
1
  module Egalite
2
- VERSION = "1.5.6"
2
+ VERSION = "1.5.7"
3
3
  end
data/lib/egalite.rb CHANGED
@@ -16,15 +16,6 @@ require 'time'
16
16
  require 'monitor'
17
17
  require 'digest/md5'
18
18
 
19
- module Rack
20
- module Utils
21
- def normalize_params(params,name,v)
22
- params[name] = v
23
- end
24
- module_function :normalize_params
25
- end
26
- end
27
-
28
19
  class CriticalError < RuntimeError
29
20
  end
30
21
 
@@ -688,6 +679,20 @@ class Handler
688
679
  res
689
680
  end
690
681
 
682
+ private
683
+ def stringify_hash(params)
684
+ sh = StringifyHash.new
685
+ params.each { |k,v|
686
+ if v.is_a?(Hash)
687
+ sh[k] = stringify_hash(v)
688
+ else
689
+ sh[k] = v
690
+ end
691
+ }
692
+ sh
693
+ end
694
+ public
695
+
691
696
  def call(rack_env)
692
697
  # set up logging
693
698
 
@@ -703,19 +708,7 @@ class Handler
703
708
  )
704
709
 
705
710
  # parameter handling
706
- params = StringifyHash.new
707
- req.params.each { |k,v|
708
- # raise 'egalite: no multiple query parameter allowed in same keyword.' if v.is_a?(Array)
709
- next unless k
710
- frags = k.split(/[\]\[]{1,2}/)
711
- last = frags.pop
712
- list = params
713
- frags.each { |frag|
714
- list[frag] ||= StringifyHash.new
715
- list = list[frag]
716
- }
717
- list[last] = v
718
- }
711
+ params = stringify_hash(req.params)
719
712
 
720
713
  puts "before-cookie: #{req.cookies.inspect}" if @opts[:cookie_debug]
721
714
 
data/test/test_handler.rb CHANGED
@@ -14,6 +14,7 @@ require 'setup'
14
14
  class TestController < Egalite::Controller
15
15
  def parameters
16
16
  raise "param foo is not bar: #{params[:foo].inspect}" unless params[:foo] == 'bar'
17
+ raise "param array isnt okay: #{params["array"].inspect}" unless params["array"] == ["1","2"] or params["array"] == ["2","1"]
17
18
  raise "param hash isnt okay: #{params[:hash].inspect}" unless params[:hash][:a] == '1' and params[:hash][:b] == '2'
18
19
  "okay"
19
20
  end
@@ -78,7 +79,7 @@ class T_Handler < Test::Unit::TestCase
78
79
  assert_no_match /private!/, last_response.body
79
80
  end
80
81
  def test_parameters
81
- post("/test/parameters", {'foo' => 'bar', 'hash[a]' => '1', 'hash[b]' => '2'})
82
+ post("/test/parameters", {'foo' => 'bar', 'hash[a]' => '1', 'hash[b]' => '2', 'array[]' => ['1','2']})
82
83
  assert last_response.ok?
83
84
  assert last_response.body =~ /okay/
84
85
  assert last_response.content_type =~ /text\/html/i
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: egalite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.6
4
+ version: 1.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shunichi Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-09 00:00:00.000000000 Z
11
+ date: 2015-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler