summaryrefslogtreecommitdiff
path: root/app/ExternalLink
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-10-09 21:17:14 -0400
committerFrederic Guillot <fred@kanboard.net>2016-10-09 21:17:14 -0400
commit26e901dfe69c29d56f5e2164d4683bab57663bb0 (patch)
tree17eed8a0a6fc4aaf3b1779ae0090426c35ed4db7 /app/ExternalLink
parent9302ff82f3fbd2f8a257488b091ba2c0a0ce6289 (diff)
Accept more file types for FileLinkProvider
Diffstat (limited to 'app/ExternalLink')
-rw-r--r--app/ExternalLink/FileLinkProvider.php17
1 files changed, 16 insertions, 1 deletions
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;
}
/**