mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-02 03:16:11 +01:00
Clean up POST keys containing square brackets, allows for regex ranges in routes (fixes #776)
This commit is contained in:
@@ -2490,6 +2490,8 @@ class AdminController
|
||||
unset($post['_json']);
|
||||
}
|
||||
|
||||
$post = $this->cleanDataKeys($post);
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
||||
@@ -2701,4 +2703,21 @@ class AdminController
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
protected function cleanDataKeys($source = []){
|
||||
$out = [];
|
||||
|
||||
if (is_array($source)) {
|
||||
foreach($source as $key => $value){
|
||||
$key = str_replace('%5B', '[', str_replace('%5D', ']', $key));
|
||||
if (is_array($value)) {
|
||||
$out[$key] = $this->cleanDataKeys($value);
|
||||
} else{
|
||||
$out[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user