tb_media 1.0.1 → 1.0.2
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,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjNhZmM2NWMwNDU3YjJlYjEyYjMzNjNkY2JhYjY1MTBhZjNkOTkxMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzI5ZWEzNzIwNTNkNmQ4YzM0MjVhODFlZmQ4MmU4ODNmODFiZWJkMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjQ2ZDIwMjI2ZjkyNDQ4MmM2MmU1N2Y1N2M3OTYyYmMyOWY0YmFmYThkNmYw
|
10
|
+
ODM2N2ZmZDM0OWNjNWUzYzFiZmEyYjljNWU1OGRjNjA1MmY5ZjFlMDkwMTA4
|
11
|
+
YWJlNzhmYThkN2Q1MGU3ZjAzYzA3NTNlYThmOWQ3ZjdhMzM0MjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjdlNjU0OWVmZjM0ZjVmYjZkZjQ1YTJhNDllMzllNTE5ZDkxMmEyMDQ4ZTg0
|
14
|
+
ZWMyZTc3Mjg2MWM3MTY2M2ZjZTc4ZTlkZjA0NzMwNDMwZTllMjFkMjBiZDI0
|
15
|
+
OTEzYWUwNTg4YTljNzBlOTUxZTkyZDk5YTM0OTg2ZjFmNzkzZTk=
|
@@ -5,17 +5,15 @@ class ProtectedMediaController < Spud::ApplicationController
|
|
5
5
|
def show
|
6
6
|
@media = SpudMedia.where(:id => params[:id]).first
|
7
7
|
if @media.blank?
|
8
|
-
|
9
|
-
redirect_to(root_url)
|
8
|
+
raise Spud::NotFoundError.new(:item => 'media')
|
10
9
|
else
|
11
10
|
if Spud::Media.config.paperclip_storage == :s3
|
12
11
|
secure_url = @media.attachment.s3_object(params[:style]).url_for(:read, :secure => true, :expires => 10.minutes)
|
13
12
|
redirect_to(secure_url.to_s)
|
14
13
|
else
|
15
|
-
filepath =
|
14
|
+
filepath = @media.attachment.path(params[:style])
|
16
15
|
if !File.exists?(filepath)
|
17
|
-
|
18
|
-
redirect_to root_path
|
16
|
+
raise Spud::NotFoundError.new(:item => 'media')
|
19
17
|
else
|
20
18
|
send_file(filepath, :disposition => 'inline')
|
21
19
|
end
|
@@ -23,4 +21,4 @@ class ProtectedMediaController < Spud::ApplicationController
|
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
26
|
-
end
|
24
|
+
end
|
data/app/models/spud_media.rb
CHANGED
@@ -114,8 +114,8 @@ class SpudMedia < ActiveRecord::Base
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
-
|
118
|
-
|
117
|
+
# If is_protected has changed, we need to make sure we are setting the appropriate permissions
|
118
|
+
# This means either moving the file in the filesystem or setting the appropriate ACL in S3
|
119
119
|
def validate_permissions
|
120
120
|
if Spud::Media.config.paperclip_storage == :filesystem
|
121
121
|
validate_permissions_filesystem
|
@@ -135,7 +135,7 @@ private
|
|
135
135
|
new_path = Paperclip::Interpolations.interpolate(Spud::Media.config.storage_path, attachment, 'original')
|
136
136
|
end
|
137
137
|
new_base_dir = File.dirname(File.dirname(new_path))
|
138
|
-
old_base_dir= File.dirname(File.dirname(old_path))
|
138
|
+
old_base_dir = File.dirname(File.dirname(old_path))
|
139
139
|
if File.directory?(old_base_dir)
|
140
140
|
FileUtils.mv(old_base_dir, new_base_dir)
|
141
141
|
end
|
@@ -4,8 +4,8 @@ module Spud
|
|
4
4
|
config_accessor :paperclip_storage,:s3_credentials,:storage_path,:storage_path_protected,:storage_url
|
5
5
|
self.paperclip_storage = :filesystem
|
6
6
|
self.s3_credentials = "#{Rails.root}/config/s3.yml"
|
7
|
-
self.storage_path = "public/system/spud_media/:id/:style/:basename.:extension"
|
8
|
-
self.storage_path_protected = "public/system/spud_media_protected/:id/:style/:basename.:extension"
|
7
|
+
self.storage_path = ":rails_root/public/system/spud_media/:id/:style/:basename.:extension"
|
8
|
+
self.storage_path_protected = ":rails_root/public/system/spud_media_protected/:id/:style/:basename.:extension"
|
9
9
|
self.storage_url = "/system/spud_media/:id/:style/:basename.:extension"
|
10
10
|
end
|
11
|
-
end
|
11
|
+
end
|
data/lib/spud_media/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tb_media
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Woods
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|