rack-grid-serve 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/grid_serve.rb +11 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a11280dd4dffb5008753a183fcbf54d09947460
|
4
|
+
data.tar.gz: cdfa9132a8459c8ba7b749c6ce713b4580c91b12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be437c29d9d41ca89318e79bf195a77a6e3537539e5402be88b73683ae68bf233b8e497d54d8fb01a698879f556572fa939f15026dcc9a43fced98ee00518798
|
7
|
+
data.tar.gz: defa40e7cfc0cdc101b70de3a6b8b4afa9883d9f0882703bec04c275bb02df693c2086f4ad01d3fc223b732fec6280dc0d700388d2df1c6cf797b2525003fa90
|
data/lib/rack/grid_serve.rb
CHANGED
@@ -8,7 +8,7 @@ end
|
|
8
8
|
|
9
9
|
class Rack::GridServe
|
10
10
|
|
11
|
-
VERSION = '0.0.
|
11
|
+
VERSION = '0.0.6'
|
12
12
|
|
13
13
|
def initialize app, opts={}
|
14
14
|
@app = app
|
@@ -28,15 +28,19 @@ class Rack::GridServe
|
|
28
28
|
if file.nil?
|
29
29
|
[404, {'Content-Type'=>'text/plain'}, 'Not Found']
|
30
30
|
else
|
31
|
-
last_modified = Time.at file.
|
31
|
+
last_modified = Time.at file['uploadDate'].to_i
|
32
32
|
headers = {
|
33
|
-
'Content-Type' => file
|
34
|
-
'ETag' => file
|
33
|
+
'Content-Type' => file['contentType'],
|
34
|
+
'ETag' => file['md5'],
|
35
35
|
'Last-Modified' => last_modified.httpdate,
|
36
36
|
'Cache-Control' => @cache_control
|
37
37
|
}
|
38
38
|
Rack::ConditionalGet.new(lambda {|cg_env|
|
39
|
-
|
39
|
+
content = String.new
|
40
|
+
@db.fs.open_download_stream(file['_id']) do |stream|
|
41
|
+
content = stream.read
|
42
|
+
end
|
43
|
+
[200, headers, [content]]
|
40
44
|
}).call(env)
|
41
45
|
end
|
42
46
|
else
|
@@ -61,12 +65,12 @@ class Rack::GridServe
|
|
61
65
|
|
62
66
|
def find_file req
|
63
67
|
str = id_or_filename req
|
64
|
-
@db.fs.
|
68
|
+
@db.fs.find({
|
65
69
|
'$or' => [
|
66
70
|
{_id: str},
|
67
71
|
{filename: str}
|
68
72
|
]
|
69
|
-
})
|
73
|
+
}).first
|
70
74
|
end
|
71
75
|
|
72
76
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-grid-serve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mickael Riga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|