File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -235,9 +235,13 @@ if (count($parsedRoutes) == 0) {
235
235
236
236
$ routes = [];
237
237
foreach ($ parsedRoutes as $ key => $ value ) {
238
- if ($ key != "routes " && $ key != "ocs " ) {
238
+ $ isOCS = $ key === "ocs " ;
239
+ $ isIndex = $ key === "routes " ;
240
+
241
+ if (!$ isOCS && !$ isIndex ) {
239
242
continue ;
240
243
}
244
+
241
245
foreach ($ value as $ route ) {
242
246
$ routeName = $ route ["name " ];
243
247
@@ -253,10 +257,10 @@ foreach ($parsedRoutes as $key => $value) {
253
257
if (str_ends_with ($ url , "/ " )) {
254
258
$ url = substr ($ url , 0 , -1 );
255
259
}
256
- if ($ key == " routes " ) {
260
+ if ($ isIndex ) {
257
261
$ url = "/index.php " . $ root . $ url ;
258
262
}
259
- if ($ key == " ocs " ) {
263
+ if ($ isOCS ) {
260
264
$ url = "/ocs/v2.php " . $ root . $ url ;
261
265
}
262
266
@@ -320,7 +324,6 @@ foreach ($parsedRoutes as $key => $value) {
320
324
}
321
325
322
326
$ isCSRFRequired = !Helpers::classMethodHasAnnotationOrAttribute ($ methodFunction , "NoCSRFRequired " );
323
- $ isOCS = $ controllerClass ->extends != "Controller " && $ controllerClass ->extends != "ApiController " ;
324
327
if ($ isCSRFRequired && !$ isOCS ) {
325
328
Logger::debug ($ routeName , "Route ignored because of required CSRF in a non-OCS controller " );
326
329
continue ;
You can’t perform that action at this time.
0 commit comments