diff --git a/api/js/etemplate/et2_extension_customfields.ts b/api/js/etemplate/et2_extension_customfields.ts index 1b70b9174c..e3b0e9e0f2 100644 --- a/api/js/etemplate/et2_extension_customfields.ts +++ b/api/js/etemplate/et2_extension_customfields.ts @@ -963,10 +963,11 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac const value = typeof e.target.value == "string" ? [e.target.value] : e.target.value; value.forEach(v => { - const info = e.target._dialog.fileInfo(v); + const info = {...e.target._dialog.fileInfo(v)}; if(!e.target.multiple) { info.name = field.name; + info.path = "/apps/" + e.target.methodId.replaceAll(":", "/"); } e.target.getParent().getWidgetById(attrs.id)?._addFile(info); }); diff --git a/api/js/etemplate/et2_widget_vfs.ts b/api/js/etemplate/et2_widget_vfs.ts index dfaad87688..b04af021ee 100644 --- a/api/js/etemplate/et2_widget_vfs.ts +++ b/api/js/etemplate/et2_widget_vfs.ts @@ -648,7 +648,7 @@ export class et2_vfsUpload extends et2_file for(var child_index = this._children.length-1; child_index >= 0; child_index--) { var child = this._children[child_index]; - if(child.options.value.path === file_data.path) + if(!child.options.value || child.options.value.path === file_data.path) { this.removeChild(child); child.destroy(); diff --git a/api/src/Etemplate/Widget/Link.php b/api/src/Etemplate/Widget/Link.php index e34391919b..1892b8363d 100644 --- a/api/src/Etemplate/Widget/Link.php +++ b/api/src/Etemplate/Widget/Link.php @@ -316,7 +316,11 @@ class Link extends Etemplate\Widget { if(!str_ends_with($dest_file, '/') && count($files) == 1) { - // 1 file to a specific filename + // 1 file to a specific filename, overwrite if already there + if(file_exists(Api\Link::vfs_path($app, $id))) + { + unlink(Api\Link::vfs_path($app, $id)); + } Api\Vfs::symlink($files[0], Api\Link::vfs_path($app, $id)); } else