From 26e901dfe69c29d56f5e2164d4683bab57663bb0 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 9 Oct 2016 21:17:14 -0400 Subject: Accept more file types for FileLinkProvider --- app/ExternalLink/FileLinkProvider.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'app/ExternalLink/FileLinkProvider.php') diff --git a/app/ExternalLink/FileLinkProvider.php b/app/ExternalLink/FileLinkProvider.php index 901f78f8..eb8c1084 100644 --- a/app/ExternalLink/FileLinkProvider.php +++ b/app/ExternalLink/FileLinkProvider.php @@ -12,6 +12,11 @@ use Kanboard\Core\ExternalLink\ExternalLinkProviderInterface; */ class FileLinkProvider extends BaseLinkProvider implements ExternalLinkProviderInterface { + protected $excludedPrefixes= array( + 'http', + 'ftp', + ); + /** * Get provider name * @@ -55,7 +60,17 @@ class FileLinkProvider extends BaseLinkProvider implements ExternalLinkProviderI */ public function match() { - return strpos($this->userInput, 'file://') === 0; + if (strpos($this->userInput, '://') === false) { + return false; + } + + foreach ($this->excludedPrefixes as $prefix) { + if (strpos($this->userInput, $prefix) === 0) { + return false; + } + } + + return true; } /** -- cgit v1.2.3