]> git.mxchange.org Git - friendica.git/commitdiff
Improve duplicate check
authorMichael <heluecht@pirati.ca>
Mon, 9 Nov 2020 20:29:42 +0000 (20:29 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 9 Nov 2020 20:29:42 +0000 (20:29 +0000)
src/Protocol/ActivityPub/Processor.php

index bd7735f5ae64197bc8e8746eb541a6b0ebbeac05..ebaa72db5feb9df3621df92d8039b642a2d4d83a 100644 (file)
@@ -154,8 +154,16 @@ class Processor
 
                                        $filetype = strtolower(substr($attach['mediaType'], 0, strpos($attach['mediaType'], '/')));
                                        if ($filetype == 'image') {
-                                               if (!empty($activity['source']) && strpos($activity['source'], $attach['url'])) {
-                                                       continue 2;
+                                               if (!empty($activity['source'])) {
+                                                       foreach ([0, 1, 2] as $size) {
+                                                               if (preg_match('#/photo/.*-' . $size . '\.#ism', $attach['url']) && 
+                                                                       strpos(preg_replace('#(/photo/.*)-[012]\.#ism', '$1-' . $size . '.', $activity['source']), $attach['url'])) {
+                                                                       continue 3;
+                                                               }
+                                                       }
+                                                       if (strpos($activity['source'], $attach['url'])) {
+                                                               continue 2;
+                                                       }
                                                }
 
                                                $item['body'] .= "\n";