File tree 3 files changed +28
-4
lines changed
3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ fix-style: php-cs-fixer.phar
40
40
cli :
41
41
docker-compose run --rm php bash
42
42
43
- install :
43
+ install : composer.json package.json
44
44
$(DOCKER_PHP ) composer install --prefer-dist --no-interaction --no-progress --ansi
45
45
$(DOCKER_NODE ) yarn install
46
46
Original file line number Diff line number Diff line change @@ -121,10 +121,18 @@ private function reduceDots($path)
121
121
unset($ parts [$ i ]);
122
122
continue ;
123
123
}
124
- if ($ i > 0 && $ parts [$ i ] === '.. ' && $ parts [$ i - $ parentOffset ] !== '.. ' ) {
125
- unset($ parts [$ i - $ parentOffset ]);
124
+
125
+ if ($ i > 0 && $ parts [$ i ] === '.. ' ) {
126
+ $ parent = $ i - $ parentOffset ;
127
+ //Make sure parent exists, if not, check the next parent etc
128
+ while ($ parent >= 0 && empty ($ parts [$ parent ])){
129
+ $ parent --;
130
+ }
131
+ //Confirm parent is valid
132
+ if (!empty ($ parts [$ parent ]) && $ parts [$ parent ] !== '.. ' ){
133
+ unset($ parts [$ parent ]);
134
+ }
126
135
unset($ parts [$ i ]);
127
- $ parentOffset += 2 ;
128
136
}
129
137
}
130
138
return '/ ' .implode ('/ ' , $ parts );
Original file line number Diff line number Diff line change @@ -179,6 +179,22 @@ public function normalizeUriProvider()
179
179
'/var/www/api/../definitions.yaml ' ,
180
180
'file:///var/www/definitions.yaml ' ,
181
181
],
182
+ [
183
+ '/./definitions.yaml ' ,
184
+ 'file:///definitions.yaml ' ,
185
+ ],
186
+ [
187
+ '/var/www/api/schema/../../definitions.yaml ' ,
188
+ 'file:///var/www/definitions.yaml ' ,
189
+ ],
190
+ [
191
+ '/var/www/api/schema/./../data/./../definitions.yaml ' ,
192
+ 'file:///var/www/api/definitions.yaml ' ,
193
+ ],
194
+ [
195
+ '/var/www/api/schema/./../definitions.yaml ' ,
196
+ 'file:///var/www/api/definitions.yaml ' ,
197
+ ],
182
198
[
183
199
'/var/www/api/../definitions.yaml#/components/Pet ' ,
184
200
'file:///var/www/definitions.yaml#/components/Pet ' ,
You can’t perform that action at this time.
0 commit comments