empty flag dossier name fix
This commit is contained in:
@@ -109,7 +109,17 @@ class MaterioFlagController extends ControllerBase {
|
||||
public function createUserFlaggingCollection(Request $request) {
|
||||
// dpm($request);
|
||||
$post_data = json_decode( $request->getContent(),TRUE);
|
||||
$name = $post_data['name'];
|
||||
$name = is_array($post_data) && is_string($post_data['name'] ?? NULL) ? trim($post_data['name']) : '';
|
||||
|
||||
// A nameless collection creates a related flag with a NULL label, which
|
||||
// makes token info building throw a TypeError and thus breaks every
|
||||
// token consumer, including recurring order closing (Stripe payments).
|
||||
if ($name === '') {
|
||||
return new JsonResponse([
|
||||
'status' => FALSE,
|
||||
'error' => 'A folder name is required.',
|
||||
], 400);
|
||||
}
|
||||
|
||||
$newFlagColl = FlaggingCollection::Create([
|
||||
'type' => 'flagging_collection_type',
|
||||
|
||||
Reference in New Issue
Block a user