Skip to content

Commit 4c9f91a

Browse files
committed
Fixes in patch:
- indenting in getQueryString function - duplicate item not allowed, comparison condition - newId in folders.class.php changed to array witout comma
1 parent cfa18a2 commit 4c9f91a

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

api/Controller/Api/BaseController.php

+6-7
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,13 @@ public function getUriSegments()
5959
public function getQueryStringParams()
6060
{
6161
$request = symfonyRequest::createFromGlobals();
62-
$queryString = $request->getQueryString();
63-
if ($request->getContentTypeFormat() != 'application/json') {
64-
parse_str(html_entity_decode($queryString), $query);
65-
return $this->sanitizeUrl($query);
66-
}
67-
68-
return $request->toArray();
62+
$queryString = $request->getQueryString();
63+
if ($request->getContentTypeFormat() != 'application/json') {
64+
parse_str(html_entity_decode($queryString), $query);
65+
return $this->sanitizeUrl($query);
66+
}
6967

68+
return $request->toArray();
7069
}
7170

7271
/**

api/Model/ItemModel.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@ private function checkForDuplicates(string $label, array $SETTINGS, array $itemI
342342
);
343343

344344
if (DB::count() > 0 && (
345-
(isset($SETTINGS['duplicate_item']) && (int) $SETTINGS['duplicate_item'] === 0))
345+
(isset($SETTINGS['duplicate_item']) && (int) $SETTINGS['duplicate_item'] === 0)
346+
&& (int) $itemInfos['personal_folder'] === 0)
346347
) {
347348
throw new Exception('Similar item already exists. Duplicates are not allowed.');
348349
}

sources/folders.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ private function updateUserFolderCache($tree, $title, $parent_id, $isPersonal, $
351351
if (empty($cache_tree)) {
352352
DB::insert(prefixTable('cache_tree'), [
353353
'user_id' => $user_id,
354-
'folders' => json_encode([$newId,]),
354+
'folders' => json_encode([$newId]),
355355
'visible_folders' => json_encode($new_json),
356356
'timestamp' => time(),
357357
'data' => '[{}]',

0 commit comments

Comments
 (0)