From ed2b95695ccb4211f502d210c1cac30eccd2304a Mon Sep 17 00:00:00 2001 From: Juan Castro Date: Fri, 14 Aug 2026 14:38:35 -0400 Subject: [PATCH] fix(gui): give each item its own share dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit single_instance keyed the dialog on the app id alone, so opening Share… on a second file focused the first file's dialog — typing a recipient there granted access to the wrong file, with only the title hinting at it. The dialog is now instanced per path: same item refocuses, different item opens fresh. Also stops pre-encoding the title, which UIWindow encodes again. Co-Authored-By: Claude Fable 5 --- src/gui/src/UI/UIWindowShare.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gui/src/UI/UIWindowShare.js b/src/gui/src/UI/UIWindowShare.js index 28fc1f82f..3195025b1 100644 --- a/src/gui/src/UI/UIWindowShare.js +++ b/src/gui/src/UI/UIWindowShare.js @@ -68,10 +68,19 @@ async function UIWindowShare (options) { h += ''; h += ''; + // One dialog per item — window-level single_instance would refocus a + // dialog still bound to a different file. + const $existing = $('.window[data-app="share"]').filter( + (_, el) => $(el).attr('data-share-path') === item_path, + ); + if ( $existing.length ) { + $existing.focusWindow(); + return; + } + const el_window = await UIWindow({ - title: `${i18n('share')} — ${html_encode(item_name)}`, + title: `${i18n('share')} — ${item_name}`, app: 'share', - single_instance: true, icon: window.icons['share-outline.svg'], uid: null, is_dir: false, @@ -96,6 +105,7 @@ async function UIWindowShare (options) { window_css: { height: 'initial' }, body_css: { width: 'initial', padding: '0', 'background-color': 'rgb(245 247 249)' }, }); + $(el_window).attr('data-share-path', item_path); const $error = $(el_window).find('.form-error-msg'); const $success = $(el_window).find('.form-success-msg');