summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--articleenhancer/xpatharticleenhancer.php4
-rw-r--r--tests/unit/articleenhancer/XPathArticleEnhancerTest.php8
2 files changed, 7 insertions, 5 deletions
diff --git a/articleenhancer/xpatharticleenhancer.php b/articleenhancer/xpatharticleenhancer.php
index 93ceaf896..0a2d6e56c 100644
--- a/articleenhancer/xpatharticleenhancer.php
+++ b/articleenhancer/xpatharticleenhancer.php
@@ -86,7 +86,9 @@ class XPathArticleEnhancer implements ArticleEnhancer {
$xpathResult = $this->substituteRelativeLinks($xpathResult, $item->getUrl());
$sanitizedResult = $this->purifier->purify($xpathResult);
- $item->setBody($sanitizedResult);
+ if( $sanitizedResult ) {
+ $item->setBody($sanitizedResult);
+ }
}
}
diff --git a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
index 26381057c..798fa9203 100644
--- a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
+++ b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
@@ -149,7 +149,7 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
->will($this->returnValue(null));
$result = $this->testEnhancer->enhance($item);
- $this->assertEquals(null, $result->getBody());
+ $this->assertEquals('Hello thar', $result->getBody());
}
@@ -172,7 +172,7 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
->will($this->returnValue(null));
$result = $this->testEnhancer->enhance($item);
- $this->assertEquals(null, $result->getBody());
+ $this->assertEquals('Hello thar', $result->getBody());
}
@@ -200,7 +200,7 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
->will($this->returnValue(null));
$result = $this->testEnhancer->enhance($item);
- $this->assertEquals(null, $result->getBody());
+ $this->assertEquals('Hello thar', $result->getBody());
}
@@ -285,4 +285,4 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
$this->assertEquals('<img src="http://www.url.com/absolute/url.png"><a target="_blank" href="mailto:test@testsite.com">mail</a>', $result->getBody());
}
-} \ No newline at end of file
+}