admin_data 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,12 +3,16 @@ module AdminData
|
|
3
3
|
|
4
4
|
def serve
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
path = File.join(AdminData.public_dir,params[:file])
|
8
|
+
expanded_path = File.expand_path(path)
|
9
|
+
|
10
|
+
# validate that expanded path has admin_data
|
11
|
+
unless expanded_path =~ /admin_data/
|
8
12
|
render :nothing => true, :status => 404 and return
|
9
13
|
end
|
10
14
|
|
11
|
-
opts = {:text => File.read(
|
15
|
+
opts = {:text => File.read(path), :cache => true}
|
12
16
|
|
13
17
|
case params[:file]
|
14
18
|
when /\.css$/i then opts[:content_type] = "text/css"
|
@@ -21,17 +25,6 @@ module AdminData
|
|
21
25
|
render opts
|
22
26
|
end
|
23
27
|
|
24
|
-
|
25
|
-
|
26
|
-
# Cached list of all assets provided by admin_data
|
27
|
-
# It is used to ensure security in the serve method
|
28
|
-
def self.admin_data_assets
|
29
|
-
@admin_data_assets ||= (
|
30
|
-
Dir.glob(File.join(AdminData.public_dir, '**', '*')).map do |path|
|
31
|
-
# we want only relative paths
|
32
|
-
path.split(AdminData.public_dir, 2).last
|
33
|
-
end
|
34
|
-
)
|
35
|
-
end
|
28
|
+
|
36
29
|
end
|
37
30
|
end
|
data/lib/admin_data/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: admin_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 2
|
10
|
+
version: 1.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Neeraj Singh
|