From 293e3c5b81904f56661798dfa16b624151ef4ccb Mon Sep 17 00:00:00 2001 From: flashwave Date: Tue, 5 Mar 2024 00:04:20 +0000 Subject: [PATCH] Only include raw file url for Danbooru posts if the ratings are General or Sensitive. --- src/Booru/Danbooru/DanbooruPost.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Booru/Danbooru/DanbooruPost.php b/src/Booru/Danbooru/DanbooruPost.php index 86704e9..029601d 100644 --- a/src/Booru/Danbooru/DanbooruPost.php +++ b/src/Booru/Danbooru/DanbooruPost.php @@ -4,6 +4,8 @@ namespace Satori\Booru\Danbooru; use Satori\Booru\IBooruPostWithSpecificTags; class DanbooruPost implements IBooruPostWithSpecificTags { + private const ALLOW_FILE_URL_RATING = ['g', 's']; + public function __construct(private array $info) {} public function getId(): string { @@ -23,7 +25,7 @@ class DanbooruPost implements IBooruPostWithSpecificTags { } public function hasFileUrl(): bool { - return array_key_exists('file_url', $this->info); + return array_key_exists('file_url', $this->info) && in_array($this->info['rating'], self::ALLOW_FILE_URL_RATING); } public function getFileUrl(): string {