[danbooru api] ignore star searches

This commit is contained in:
Shish
2023-07-03 11:28:10 +01:00
committed by Shish
parent 3c18ebd40c
commit f7f0c11ee8
2 changed files with 5 additions and 0 deletions

View File

@@ -195,6 +195,10 @@ class DanbooruApi extends Extension
}
$tags = isset($_GET['tags']) ? Tag::explode($_GET['tags']) : [];
// danbooru API clients often set tags=*
$tags = array_filter($tags, static function ($element) {
return $element !== "*";
});
$count = Image::count_images($tags);
$results = Image::find_images(max($start, 0), min($limit, 100), $tags);
}

View File

@@ -15,6 +15,7 @@ class DanbooruApiTest extends ShimmiePHPUnitTestCase
$this->get_page("api/danbooru/find_posts");
$this->get_page("api/danbooru/find_posts", ["id"=>$image_id]);
$this->get_page("api/danbooru/find_posts", ["md5"=>"17fc89f372ed3636e28bd25cc7f3bac1"]);
$this->get_page("api/danbooru/find_posts", ["tags"=>"*"]);
$this->get_page("api/danbooru/find_tags");
$this->get_page("api/danbooru/find_tags", ["id"=>1]);