Skip to content

Commit ac0bc77

Browse files
committed
Return Content Type
1 parent 3d01a9b commit ac0bc77

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ Release pending.
219219
* Added: Caching of ActivityPub Endpoints in WP REST API
220220
* Added: Fade out WB REST CACHE Icon @ Admin Bar
221221
* Added: Disable UpdraftPlus @ Admin Bar
222+
* Fixed: Content Type Return @ WP REST CACHE
222223

223224
### 0.8
224225

unmus_cache.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @package unmus
1010
* @since 0.9
1111
*
12-
* @link https://epiph.yt/en/blog/2025/activitypub-plugin-and-accidental-ddos/
12+
* @link https://epiph.yt/blog/2025/das-activitypub-plugin-und-der-versehentliche-ddos/
1313
*/
1414

1515
// Security: Stops code execution if WordPress is not loaded
@@ -111,7 +111,8 @@ function unmus_is_activitypub_endpoint( string $uri ) :bool {
111111
function unmus_cache_determine_object_type( $object_type, $cache_key, $data, $uri ) {
112112

113113
if (unmus_is_activitypub_endpoint( $uri ) ) {
114-
$object_type = 'ActivityPub';
114+
return 'ActivityPub';
115+
} else {
115116
return $object_type;
116117
}
117118
}
@@ -153,13 +154,14 @@ function unmus_cache_reset_by_transition_post_status( string $new_status, string
153154
* Always return false for ActivityPub endpoints,
154155
* since cache entries cannot be flushed otherwise.
155156
*
156-
* @param bool $is_single Whether the current cache represents a single item
157-
* @param mixed $data Data to cache
158-
* @param string $uri Request URI
159-
* @return bool Whether the cache represents a single item
157+
* @param bool $is_single Whether the current cache represents a single item
158+
* @param mixed $data Data to cache
159+
* @param string $uri Request URI
160+
* @return bool Whether the cache represents a single item
160161
*/
161162

162163
function set_is_single_item( bool $is_single, mixed $data, string $uri ): bool {
164+
163165
if ( unmus_is_activitypub_endpoint( $uri ) ) {
164166
return false;
165167
}

0 commit comments

Comments
 (0)