Skip to content

Commit a9e7ff6

Browse files
jessevzjessevz
andauthored
Fixed bug where there was no support for upload-metadata without value (#1901)
Co-authored-by: jessevz <jesse.van.zutphen@nfi.nl>
1 parent 5d00fc4 commit a9e7ff6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/inc/apiv2/helper/importFile.routes.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,15 @@ function processPost(Request $request, Response $response, array $args): Respons
160160
foreach ($list as $item) {
161161
list($key, $b64val) = explode(" ", $item, 2);
162162
if ($b64val == null) {
163-
$response->getBody()->write("Error Upload-Metadata, should be a key value pair that is separated by a space, no value has been provided");
164-
return $response->withStatus(400);
163+
// Some keys dont have a value
164+
$update_metadata[$key] = null;
165165
}
166166
if (($val = base64_decode($b64val, true)) === false) {
167167
$response->getBody()->write("Error Upload-Metadata '$key' invalid base64 encoding");
168168
return $response->withStatus(400);
169+
} else {
170+
$update_metadata[$key] = $val;
169171
}
170-
$update_metadata[$key] = $val;
171172
}
172173
}
173174
// TODO: Should filename be mandatory?

0 commit comments

Comments
 (0)