From 827c537f612727b35f8bc36c0feefd403a197e61 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sat, 8 Oct 2016 18:24:37 -0500 Subject: [PATCH] Issue 164: External file name prompt required --- indefero/src/IDF/Form/Upload.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/indefero/src/IDF/Form/Upload.php b/indefero/src/IDF/Form/Upload.php index c49520e..f0018ee 100644 --- a/indefero/src/IDF/Form/Upload.php +++ b/indefero/src/IDF/Form/Upload.php @@ -146,11 +146,13 @@ class IDF_Form_Upload extends Pluf_Form throw new Pluf_Form_Invalid(__("Must upload a file or specify an external file")); } - foreach(explode(".", $this->cleaned_data["ext_file_name"]) as $section) { - if (!ctype_alnum(($section))) { - throw new Pluf_Form_Invalid(__("External file name must not contain characters other than a-zA-Z and .")); - } - } + if ($this->cleaned_data["ext_file_name"] != "") { + foreach(explode(".", $this->cleaned_data["ext_file_name"]) as $section) { + if (!ctype_alnum(($section))) { + throw new Pluf_Form_Invalid(__("External file name must not contain characters other than a-zA-Z and .")); + } + } + } return $this->cleaned_data; }