diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-08-14 01:57:39 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-08-14 01:57:39 +0200 |
commit | 2d4806ad4d2ae40c4ee12f9781218a6369b6c25b (patch) | |
tree | d40d9c19507a94ade82323c73bddecf025ad466d | |
parent | 07eb992fa5576d77abafde2688ed90f81060d285 (diff) |
also allow magnet urls in article links, fix #313
-rw-r--r-- | db/item.php | 2 | ||||
-rw-r--r-- | tests/unit/db/ItemTest.php | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/db/item.php b/db/item.php index 1632d5438..2a903f99e 100644 --- a/db/item.php +++ b/db/item.php @@ -121,7 +121,7 @@ class Item extends Entity implements IAPI { public function setUrl($url) { $url = trim($url); - if(strpos($url, 'http') === 0) { + if(strpos($url, 'http') === 0 || strpos($url, 'magnet') === 0) { parent::setUrl($url); } } diff --git a/tests/unit/db/ItemTest.php b/tests/unit/db/ItemTest.php index 971d808f0..db9153086 100644 --- a/tests/unit/db/ItemTest.php +++ b/tests/unit/db/ItemTest.php @@ -126,4 +126,10 @@ class ItemTest extends \PHPUnit_Framework_TestCase { } + public function testSetMagnetUrl() { + $item = new Item(); + $item->setUrl('magnet://link.com'); + $this->assertEquals('magnet://link.com', $item->getUrl()); + } + }
\ No newline at end of file |