effective_storage 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4d882d7dc41b30bee6a440cffcbcc0008dc697fc5ace3455ff2f427910325d1
|
4
|
+
data.tar.gz: a6a536963a71e23feeb0106193a7d731372f3190cf48632aa5cb70388636df31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc59eaafef6892fb1b3826e7ad0ee0f5aacf175f553cdae2eb8bc15a2631a72ea4681f2ef6b7c594f5497007df06f7acfd91c9f76480b4d49e96811b1a637781
|
7
|
+
data.tar.gz: 12d4c064a19a72670545e52f61c986c80455c90ae4852af9c3e272aea56a4331d7e7e0065e9cdfeff860f25f1e12f282b180815dd1145e1af33e66d7e2c863a4
|
@@ -67,8 +67,8 @@ module ActiveStorageAuthorization
|
|
67
67
|
# If we are authorized on any attached record, permit the download
|
68
68
|
return true if @blob.attachments.any? { |attachment| authorized_attachment_download?(attachment) }
|
69
69
|
|
70
|
-
# Otherwise raise a
|
71
|
-
head(:
|
70
|
+
# Otherwise raise a 404 Not Found and block the download
|
71
|
+
head(:not_found)
|
72
72
|
|
73
73
|
# Raise an exception to log unauthorized request
|
74
74
|
raise_exception()
|
@@ -113,7 +113,8 @@ module ActiveStorageAuthorization
|
|
113
113
|
# This is a has_one_attached or has_many_attached record
|
114
114
|
# Or an ActionText::RichText object, that belongs_to a record
|
115
115
|
def authorized_attachment_download?(attachment)
|
116
|
-
|
116
|
+
# DO NOT USE .blank? or .present? here. They return incorrect values.
|
117
|
+
return false if attachment.record.nil?
|
117
118
|
|
118
119
|
# Associated Record
|
119
120
|
record = attachment.record
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|