parent
528dc633aa
commit
0360c57c79
|
|
@ -74,7 +74,7 @@ class AttachmentLinkProvider extends BaseLinkProvider implements ExternalLinkPro
|
|||
*/
|
||||
public function match()
|
||||
{
|
||||
if (preg_match('/^https?:\/\/.*\.([^\/]+)$/', $this->userInput, $matches)) {
|
||||
if (preg_match('/^https?:\/\/.*\/.*\.([^\/]+)$/', $this->userInput, $matches)) {
|
||||
return $this->isValidExtension($matches[1]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ class AttachmentLinkProviderTest extends Base
|
|||
$attachmentLinkProvider->setUserTextInput(' https://kanboard.org/folder/archive.tar ');
|
||||
$this->assertTrue($attachmentLinkProvider->match());
|
||||
|
||||
$attachmentLinkProvider->setUserTextInput('https://www.github.io/folder/archive.zip');
|
||||
$this->assertTrue($attachmentLinkProvider->match());
|
||||
|
||||
$attachmentLinkProvider->setUserTextInput('http:// invalid url');
|
||||
$this->assertFalse($attachmentLinkProvider->match());
|
||||
|
||||
|
|
@ -54,6 +57,12 @@ class AttachmentLinkProviderTest extends Base
|
|||
|
||||
$attachmentLinkProvider->setUserTextInput('https://kanboard.org/folder/document.do');
|
||||
$this->assertFalse($attachmentLinkProvider->match());
|
||||
|
||||
$attachmentLinkProvider->setUserTextInput('https://www.github.io/folder/document.html');
|
||||
$this->assertFalse($attachmentLinkProvider->match());
|
||||
|
||||
$attachmentLinkProvider->setUserTextInput('https://www.github.io');
|
||||
$this->assertFalse($attachmentLinkProvider->match());
|
||||
}
|
||||
|
||||
public function testGetLink()
|
||||
|
|
|
|||
Loading…
Reference in New Issue