From 4f713e323790da640e0451d1d76f618bfa01553c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laurent=20L=C3=A9onard?= <laurent@openthink.be>
Date: Sat, 22 Oct 2016 01:57:25 +0200
Subject: [PATCH] Add file scheme to allowed URIs schemes for links

---
 htdocs/core/actions_linkedfiles.inc.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php
index 6f2d4a2128f..672da011a79 100644
--- a/htdocs/core/actions_linkedfiles.inc.php
+++ b/htdocs/core/actions_linkedfiles.inc.php
@@ -40,7 +40,7 @@ elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
         $link = GETPOST('link', 'alpha');
         if ($link)
         {
-            if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') {
+            if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://' && substr($link, 0, 7) != 'file://') {
                 $link = 'http://' . $link;
             }
             dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link);
@@ -124,7 +124,7 @@ elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'a
     if ($f)
     {
         $link->url = GETPOST('link', 'alpha');
-        if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://')
+        if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://' && substr($link->url, 0, 7) != 'file://')
         {
             $link->url = 'http://' . $link->url;
         }
-- 
GitLab