diff --git a/controllers/TagsController.php b/controllers/TagsController.php index dad6a482..abb1a7c3 100644 --- a/controllers/TagsController.php +++ b/controllers/TagsController.php @@ -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); diff --git a/model/API.inc.php b/model/API.inc.php index 863104a3..da398538 100644 --- a/model/API.inc.php +++ b/model/API.inc.php @@ -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