From a38217df2b9ee5a4cea8dba1066d45d8e33db08a Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Thu, 8 Oct 2020 13:02:56 +0100 Subject: [PATCH 1/2] fix: check prefix correctly `strpos(string, sub)` returns `false` if `sub` is not present in `string`. In this case, we want to check if `sub` is not a *prefix* of `string`. Hence, we just need to test if the returned position is simply different from 0. --- lib/XRay/PostType.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/XRay/PostType.php b/lib/XRay/PostType.php index ed6610a..3c9dc72 100644 --- a/lib/XRay/PostType.php +++ b/lib/XRay/PostType.php @@ -59,7 +59,7 @@ class PostType { // If this processed "name" property value is NOT a prefix of the // processed "content" property, then it is an article post. - if(strpos($content, $name) === false) { + if(strpos($content, $name) !== 0) { return 'article'; } From c463aa90e34e2febc77245e5e27711bafa519f6c Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Thu, 8 Oct 2020 13:10:09 +0100 Subject: [PATCH 2/2] fix: remove 'Bridgy Fed' title The test is checking for notes, but 'Bridge Fed' is, in fact, an article according to the post discovery algorithm. Also, I'm adding as note that the main difference between a note and an article is that the latter has a title, while the first doesn't. --- tests/data/feed.example.com/rss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/data/feed.example.com/rss b/tests/data/feed.example.com/rss index 5c687a5..ef3be93 100644 --- a/tests/data/feed.example.com/rss +++ b/tests/data/feed.example.com/rss @@ -90,7 +90,7 @@ Connection: keep-alive 0 - Bridgy Fed + https://snarfed.org/2017-10-22_bridgy-fed https://snarfed.org/2017-10-22_bridgy-fed#respond Mon, 23 Oct 2017 04:01:46 +0000 @@ -194,4 +194,4 @@ Connection: keep-alive 84 - \ No newline at end of file +