Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions controllers/TagsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ public function tags() {
// Filter for specific tags with "?tag=foo || bar"
$tagNames = !empty($this->queryParams['tag'])
? explode(' || ', $this->queryParams['tag']): array();
// Replace \|| with || to allow for tags with literal '||'.
$tagNames = array_map(function ($name) {
return str_replace("\||", "||", $name);
}, $tagNames);
Zotero_DB::beginTransaction();
foreach ($tagNames as $tagName) {
$tagIDs = Zotero_Tags::getIDs($this->objectLibraryID, $tagName);
Expand Down
5 changes: 5 additions & 0 deletions model/API.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,11 @@ public static function getSearchParamValues($params, $param) {
// Separate into boolean OR parts
$parts = preg_split("/\s+\|\|\s+/", $val);

// Replace \|| with || to allow for tags with literal '||'.
$parts = array_map(function ($part) {
return str_replace("\||", "||", $part);
}, $parts);

$val = array(
'negation' => $negation,
'values' => $parts
Expand Down