فهرست منبع

Merge pull request #4896 from pixelfed/staging

Update AP helpers, fix sensitive bug
daniel 1 سال پیش
والد
کامیت
3a557d7ffc
2فایلهای تغییر یافته به همراه5 افزوده شده و 3 حذف شده
  1. 1 0
      CHANGELOG.md
  2. 4 3
      app/Util/ActivityPub/Helpers.php

+ 1 - 0
CHANGELOG.md

@@ -95,6 +95,7 @@
 - Update TransformImports command, fix import service condition ([32c59f04](https://github.com/pixelfed/pixelfed/commit/32c59f04))
 - Update AP helpers, more efficently update post count ([7caed381](https://github.com/pixelfed/pixelfed/commit/7caed381))
 - Update AP helpers, refactor post count decrement logic ([b81ae577](https://github.com/pixelfed/pixelfed/commit/b81ae577))
+- Update AP helpers, fix sensitive bug ([00ed330c](https://github.com/pixelfed/pixelfed/commit/00ed330c))
 -  ([](https://github.com/pixelfed/pixelfed/commit/))
 
 ## [v0.11.9 (2023-08-21)](https://github.com/pixelfed/pixelfed/compare/v0.11.8...v0.11.9)

+ 4 - 3
app/Util/ActivityPub/Helpers.php

@@ -548,10 +548,11 @@ class Helpers {
 
     public static function getSensitive($activity, $url)
     {
-        $id = isset($activity['id']) ? self::pluckval($activity['id']) : self::pluckval($url);
-        $url = isset($activity['url']) ? self::pluckval($activity['url']) : $id;
-        $urlDomain = parse_url($url, PHP_URL_HOST);
+        if(!$url || !strlen($url)) {
+            return true;
+        }
 
+        $urlDomain = parse_url($url, PHP_URL_HOST);
         $cw = isset($activity['sensitive']) ? (bool) $activity['sensitive'] : false;
 
         if(in_array($urlDomain, InstanceService::getNsfwDomains())) {