diff --git a/htdocs/core/tpl/document_actions.tpl.php b/htdocs/core/tpl/document_actions.tpl.php index bd26e13672d..8ae243e47d3 100644 --- a/htdocs/core/tpl/document_actions.tpl.php +++ b/htdocs/core/tpl/document_actions.tpl.php @@ -7,10 +7,12 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { } elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { if ($object->id) { $link = GETPOST('link', 'alpha'); - if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') { - $link = 'http://' . $link; + if ($link) { + if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') { + $link = 'http://' . $link; + } + dol_add_file_process($upload_dir, 0, 1, 'userfile', $link); } - dol_add_file_process($upload_dir, 0, 1, 'userfile', $link); } }