From d8827da73ff9ac94fcfd5c3d72a90ffa8ccc7ac9 Mon Sep 17 00:00:00 2001 From: ralf Date: Mon, 28 Mar 2022 13:32:05 +0300 Subject: [PATCH] do NOT overwrite everything, if vfs-upload is used without id: - using fallback id of "file_widget" the client-side uses - ignore validation, if there is no id --- api/src/Etemplate/Widget/File.php | 5 ++++- api/src/Etemplate/Widget/Vfs.php | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/api/src/Etemplate/Widget/File.php b/api/src/Etemplate/Widget/File.php index db1f92bacd..1fb1b654aa 100644 --- a/api/src/Etemplate/Widget/File.php +++ b/api/src/Etemplate/Widget/File.php @@ -47,6 +47,9 @@ class File extends Etemplate\Widget if($xml) parent::__construct($xml); + // set fallback-id client-side uses + if (empty($this->id)) $this->id = 'file_widget'; + // Legacy multiple - id ends in [] if(substr($this->id,-2) == '[]') { @@ -384,4 +387,4 @@ class File extends Etemplate\Widget self::setElementAttribute($form_name, 'chunk_size', ($upload_max_filesize-1024*1024)/2); } } -} +} \ No newline at end of file diff --git a/api/src/Etemplate/Widget/Vfs.php b/api/src/Etemplate/Widget/Vfs.php index 08138dd3d8..8100b5a7f4 100644 --- a/api/src/Etemplate/Widget/Vfs.php +++ b/api/src/Etemplate/Widget/Vfs.php @@ -352,7 +352,7 @@ class Vfs extends File parent::validate($cname, $expand, $content, $validated); break; } - if (true) $valid = $value; + if (!empty($this->id)) $valid = $value; } /** @@ -701,4 +701,4 @@ class Vfs extends File $apps['api-accounts']); return $apps; } -} +} \ No newline at end of file