Bulk creation: ignore blank lines
This commit is contained in:
parent
6a71675887
commit
34c8f558e5
2 changed files with 5 additions and 1 deletions
|
@ -46,6 +46,9 @@ public function displayCreateBatchForms(Request $request, Response $response): R
|
|||
|
||||
$links = [];
|
||||
foreach ($urls as $url) {
|
||||
if (empty($url)) {
|
||||
continue;
|
||||
}
|
||||
$link = $this->buildLinkDataFromUrl($request, $url);
|
||||
$data = $this->buildFormData($link, $link['linkIsNew'], $request);
|
||||
$data['token'] = $this->container->sessionManager->generateToken();
|
||||
|
|
|
@ -36,6 +36,7 @@ public function testDisplayCreateFormBatch(): void
|
|||
$urls = [
|
||||
'https://domain1.tld/url1',
|
||||
'https://domain2.tld/url2',
|
||||
' ',
|
||||
'https://domain3.tld/url3',
|
||||
];
|
||||
|
||||
|
@ -57,6 +58,6 @@ public function testDisplayCreateFormBatch(): void
|
|||
static::assertCount(3, $assignedVariables['links']);
|
||||
static::assertSame($urls[0], $assignedVariables['links'][0]['link']['url']);
|
||||
static::assertSame($urls[1], $assignedVariables['links'][1]['link']['url']);
|
||||
static::assertSame($urls[2], $assignedVariables['links'][2]['link']['url']);
|
||||
static::assertSame($urls[3], $assignedVariables['links'][2]['link']['url']);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue