attach 1.0.4 → 1.0.5
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 +4 -4
- data/lib/attach/backends/file_system.rb +5 -5
- data/lib/attach/middleware.rb +1 -1
- data/lib/attach/version.rb +1 -1
- 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: 2056ebcc16201f4fe826932ed8db99a711d32e27
|
4
|
+
data.tar.gz: 06ccf7d7fe3d431341cbebc15492ce557a5daed8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b769025cdcc24a045e155db751f7a0feaa8094d17b5bec19e5c1b104e791e78113b471f400ee80bf792288e4709047eb632ffc1797677b2fc48e346c67fbb55
|
7
|
+
data.tar.gz: 68071df914675ff62f3c862ff93dc8024b8b480158fe72ca64ebc1632c25cac8fcc224e2ea953eec3d1a1a90497debec58f634635b6e4ae3e974bcfd26de98d5
|
@@ -6,20 +6,20 @@ module Attach
|
|
6
6
|
class FileSystem < Abstract
|
7
7
|
|
8
8
|
def read(attachment)
|
9
|
-
File.read(path_for_attachment(attachment))
|
9
|
+
::File.read(path_for_attachment(attachment))
|
10
10
|
end
|
11
11
|
|
12
12
|
def write(attachment, data)
|
13
13
|
path = path_for_attachment(attachment)
|
14
|
-
FileUtils.mkdir_p(File.dirname(path))
|
15
|
-
File.open(path, 'wb') do |f|
|
14
|
+
FileUtils.mkdir_p(::File.dirname(path))
|
15
|
+
::File.open(path, 'wb') do |f|
|
16
16
|
f.write(data)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
def delete(attachment)
|
21
21
|
path = path_for_attachment(attachment)
|
22
|
-
FileUtils.rm(path) if File.file?(path)
|
22
|
+
FileUtils.rm(path) if ::File.file?(path)
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
@@ -29,7 +29,7 @@ module Attach
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def path_for_attachment(attachment)
|
32
|
-
File.join(root_dir, attachment.token[0,2], attachment.token[2,2], attachment.token[4,40])
|
32
|
+
::File.join(root_dir, attachment.token[0,2], attachment.token[2,2], attachment.token[4,40])
|
33
33
|
end
|
34
34
|
|
35
35
|
end
|
data/lib/attach/middleware.rb
CHANGED
@@ -14,7 +14,7 @@ module Attach
|
|
14
14
|
'Content-Length' => attachment.file_size.to_s,
|
15
15
|
'Content-Type' => attachment.file_type,
|
16
16
|
'Cache-Control' => "#{attachment.cache_type || 'private'}, immutable, max-age=#{attachment.cache_max_age || 30.days.to_i}",
|
17
|
-
'Content-Disposition' => "#{attachment.disposition || 'attachment'}; filename=\"#{attachment.file_name}\"
|
17
|
+
'Content-Disposition' => "#{attachment.disposition || 'attachment'}; filename=\"#{attachment.file_name}\""
|
18
18
|
},
|
19
19
|
[attachment.binary]]
|
20
20
|
else
|
data/lib/attach/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attach
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: records_manipulator
|