From 3a2b0bd693828afea925362fbfbe8a7ca069f72c Mon Sep 17 00:00:00 2001 From: Fornax Date: Wed, 17 May 2023 19:41:47 +0200 Subject: [PATCH] Fix sharing URL and share last public ID instead of first --- svelte/src/filesystem/Sharebar.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/svelte/src/filesystem/Sharebar.svelte b/svelte/src/filesystem/Sharebar.svelte index f1b7893..3ee3fc1 100644 --- a/svelte/src/filesystem/Sharebar.svelte +++ b/svelte/src/filesystem/Sharebar.svelte @@ -3,8 +3,8 @@ export const generate_share_url = path => { let share_url = "" let bucket_idx = -1 - // Find the first node in the path that has a public ID - for (let i = 0; i < path.length; i++) { + // Find the last node in the path that has a public ID + for (let i = path.length-1; i > 0; i--) { if (path[i].id !== undefined && path[i].id !== "me") { bucket_idx = i break @@ -17,7 +17,7 @@ export const generate_share_url = path => { // Construct the path starting from the bucket for (let i = bucket_idx+1; i < path.length; i++) { - share_url += "/" + encodeURI(path[i].name) + share_url += "/" + encodeURIComponent(path[i].name) } }