diff --git a/readme.md b/readme.md index 2e98d88..d022eae 100644 --- a/readme.md +++ b/readme.md @@ -219,6 +219,7 @@ Release pending. * Added: Caching of ActivityPub Endpoints in WP REST API * Added: Fade out WB REST CACHE Icon @ Admin Bar * Added: Disable UpdraftPlus @ Admin Bar +* Fixed: Content Type Return @ WP REST CACHE ### 0.8 diff --git a/unmus_cache.php b/unmus_cache.php index 7013ddf..9f45d8e 100644 --- a/unmus_cache.php +++ b/unmus_cache.php @@ -9,7 +9,7 @@ * @package unmus * @since 0.9 * - * @link https://epiph.yt/en/blog/2025/activitypub-plugin-and-accidental-ddos/ + * @link https://epiph.yt/blog/2025/das-activitypub-plugin-und-der-versehentliche-ddos/ */ // Security: Stops code execution if WordPress is not loaded @@ -111,7 +111,8 @@ function unmus_is_activitypub_endpoint( string $uri ) :bool { function unmus_cache_determine_object_type( $object_type, $cache_key, $data, $uri ) { if (unmus_is_activitypub_endpoint( $uri ) ) { - $object_type = 'ActivityPub'; + return 'ActivityPub'; + } else { return $object_type; } } @@ -153,13 +154,14 @@ function unmus_cache_reset_by_transition_post_status( string $new_status, string * Always return false for ActivityPub endpoints, * since cache entries cannot be flushed otherwise. * - * @param bool $is_single Whether the current cache represents a single item - * @param mixed $data Data to cache - * @param string $uri Request URI - * @return bool Whether the cache represents a single item + * @param bool $is_single Whether the current cache represents a single item + * @param mixed $data Data to cache + * @param string $uri Request URI + * @return bool Whether the cache represents a single item */ function set_is_single_item( bool $is_single, mixed $data, string $uri ): bool { + if ( unmus_is_activitypub_endpoint( $uri ) ) { return false; }