From aacac198a8c8a3561b21c0b271024e3457a8bb40 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sun, 23 Feb 2020 12:59:15 -0600 Subject: [PATCH] fix checking for empty post content XRay now looks for images inside the HTML and does not consider those empty posts --- lib/XRay/Formats/Format.php | 33 +++++++++ lib/XRay/Formats/Mf2.php | 12 ++- tests/SanitizeTest.php | 73 +++++++++++++++++-- .../sanitize.example/content-is-only-video | 11 +++ .../entry-with-img-no-implied-photo | 1 + .../photo-in-content-no-p-with-alt | 11 +++ .../photo-in-content-no-p-with-url-photo | 12 +++ .../photo-in-content-with-alt-no-text | 11 +++ .../photo-in-content-with-p-no-alt | 11 +++ 9 files changed, 165 insertions(+), 10 deletions(-) create mode 100644 tests/data/sanitize.example/content-is-only-video create mode 100644 tests/data/sanitize.example/photo-in-content-no-p-with-alt create mode 100644 tests/data/sanitize.example/photo-in-content-no-p-with-url-photo create mode 100644 tests/data/sanitize.example/photo-in-content-with-alt-no-text create mode 100644 tests/data/sanitize.example/photo-in-content-with-p-no-alt diff --git a/lib/XRay/Formats/Format.php b/lib/XRay/Formats/Format.php index 6a58288..0042f40 100644 --- a/lib/XRay/Formats/Format.php +++ b/lib/XRay/Formats/Format.php @@ -75,6 +75,8 @@ abstract class Format implements iFormat { } $def = $config->getHTMLDefinition(true); + + // add HTML