apipie-rails 0.5.14 → 0.5.15
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 +5 -5
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -1
- data/app/controllers/apipie/apipies_controller.rb +18 -8
- data/lib/apipie/resource_description.rb +1 -0
- data/lib/apipie/static_dispatcher.rb +3 -2
- data/lib/apipie/version.rb +1 -1
- data/lib/tasks/apipie.rake +1 -1
- data/spec/lib/file_handler_spec.rb +18 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a05f50c6c4364f6e0c0ad119a9061f4daef9e2f5
|
4
|
+
data.tar.gz: 05ea27245215efd3d2e2d685fa5e82b9de0e17b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07198e0935b6f4c8ea51616153b29578213614de9a783a602d9edf9ebde2223652ddb1482a55a48a0bdb6582423fe4ff6c807412c4bb0529736b5c0d4f3453b4
|
7
|
+
data.tar.gz: a4cb3227c448f0f444e6c28972b8d1d6788f011ab3c9bdea8accbf9b41ec614393edff8aafd8c1a521f3a18f05e3eaee767da65cf0f49a2fedfac99f4e046a3a
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
Changelog
|
2
2
|
===========
|
3
3
|
|
4
|
+
[v0.5.15](https://github.com/Apipie/apipie-rails/tree/v0.5.15) (2019-01-03)
|
5
|
+
--------
|
6
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.5.14...v0.5.15)
|
7
|
+
|
8
|
+
|
9
|
+
- Fix authorization of resources [\#655](https://github.com/Apipie/apipie-rails/pull/655) ([NielsKSchjoedt](https://github.com/NielsKSchjoedt))
|
10
|
+
- Use configured value when swagger\_content\_type\_input argument is not passed [\#648](https://github.com/Apipie/apipie-rails/pull/648) ([nullnull](https://github.com/nullnull))
|
11
|
+
- Fix "ArgumentError: string contains null byte" on malformed stings [\#477](https://github.com/Apipie/apipie-rails/pull/477) ([avokhmin](https://github.com/avokhmin))
|
12
|
+
|
4
13
|
v0.5.14
|
5
14
|
-------
|
6
15
|
- HTML escape validator values [\#645](https://github.com/Apipie/apipie-rails/pull/645) ([ekohl](https://github.com/ekohl))
|
data/Gemfile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Gemfile.rails50
|
@@ -115,20 +115,30 @@ module Apipie
|
|
115
115
|
|
116
116
|
new_doc = { :docs => @doc[:docs].clone }
|
117
117
|
|
118
|
-
new_doc[:docs][:resources] = @doc[:docs][:resources].
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
false
|
118
|
+
new_doc[:docs][:resources] = if @doc[:docs][:resources].kind_of?(Array)
|
119
|
+
@doc[:docs][:resources].select do |resource|
|
120
|
+
authorize_resource(resource)
|
121
|
+
end
|
122
|
+
else
|
123
|
+
@doc[:docs][:resources].select do |_resource_name, resource|
|
124
|
+
authorize_resource(resource)
|
126
125
|
end
|
127
126
|
end
|
128
127
|
|
129
128
|
new_doc
|
130
129
|
end
|
131
130
|
|
131
|
+
def authorize_resource resource
|
132
|
+
if instance_exec(resource[:id], nil, resource, &Apipie.configuration.authorize)
|
133
|
+
resource[:methods] = resource[:methods].select do |m|
|
134
|
+
instance_exec(resource[:id], m[:name], m, &Apipie.configuration.authorize)
|
135
|
+
end
|
136
|
+
true
|
137
|
+
else
|
138
|
+
false
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
132
142
|
def get_format
|
133
143
|
[:resource, :method, :version].each do |par|
|
134
144
|
next unless params[par]
|
@@ -8,9 +8,10 @@ module Apipie
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def match?(path)
|
11
|
-
|
11
|
+
# Replace all null bytes
|
12
|
+
path = ::Rack::Utils.unescape(path || '').gsub(/\x0/, '')
|
12
13
|
|
13
|
-
full_path = path.empty? ? @root : File.join(@root,
|
14
|
+
full_path = path.empty? ? @root : File.join(@root, path)
|
14
15
|
paths = "#{full_path}#{ext}"
|
15
16
|
|
16
17
|
matches = Dir[paths]
|
data/lib/apipie/version.rb
CHANGED
data/lib/tasks/apipie.rake
CHANGED
@@ -191,7 +191,7 @@ namespace :apipie do
|
|
191
191
|
|
192
192
|
def generate_swagger_using_args(args, out)
|
193
193
|
args.with_defaults(:version => Apipie.configuration.default_version,
|
194
|
-
:swagger_content_type_input => :form_data,
|
194
|
+
:swagger_content_type_input => Apipie.configuration.swagger_content_type_input || :form_data,
|
195
195
|
:filename_suffix => nil)
|
196
196
|
Apipie.configuration.swagger_content_type_input = args[:swagger_content_type_input].to_sym
|
197
197
|
count = 0
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Apipie::FileHandler do
|
4
|
+
|
5
|
+
describe "match?" do
|
6
|
+
let(:file_handler) { Apipie::FileHandler.new File.dirname(__FILE__) }
|
7
|
+
|
8
|
+
it { expect(file_handler.match? 'file_handler_spec.rb').to be_truthy }
|
9
|
+
it { expect(file_handler.match? 'foo.bar').to be_falsy }
|
10
|
+
|
11
|
+
context 'path contains null bytes' do
|
12
|
+
let(:path) { "foo%00.bar" }
|
13
|
+
|
14
|
+
it { expect(file_handler.match? path).to be_falsy }
|
15
|
+
it { expect { file_handler.match? path }.to_not raise_error }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apipie-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Pokorny
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-01-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -299,6 +299,7 @@ files:
|
|
299
299
|
- spec/lib/extractor/extractor_spec.rb
|
300
300
|
- spec/lib/extractor/middleware_spec.rb
|
301
301
|
- spec/lib/extractor/writer_spec.rb
|
302
|
+
- spec/lib/file_handler_spec.rb
|
302
303
|
- spec/lib/method_description_spec.rb
|
303
304
|
- spec/lib/param_description_spec.rb
|
304
305
|
- spec/lib/param_group_spec.rb
|
@@ -331,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
331
332
|
version: '0'
|
332
333
|
requirements: []
|
333
334
|
rubyforge_project:
|
334
|
-
rubygems_version: 2.
|
335
|
+
rubygems_version: 2.5.1
|
335
336
|
signing_key:
|
336
337
|
specification_version: 4
|
337
338
|
summary: Rails REST API documentation tool
|
@@ -395,6 +396,7 @@ test_files:
|
|
395
396
|
- spec/lib/extractor/extractor_spec.rb
|
396
397
|
- spec/lib/extractor/middleware_spec.rb
|
397
398
|
- spec/lib/extractor/writer_spec.rb
|
399
|
+
- spec/lib/file_handler_spec.rb
|
398
400
|
- spec/lib/method_description_spec.rb
|
399
401
|
- spec/lib/param_description_spec.rb
|
400
402
|
- spec/lib/param_group_spec.rb
|