diff --git a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/RoleDropdown.vue b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/RoleDropdown.vue index 1430e02233e..26b26097532 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/RoleDropdown.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/RoleDropdown.vue @@ -183,7 +183,7 @@ export default defineComponent({ }, share() { // the root share has an empty key in the shares tree. That's the reason why we retrieve the share by an empty key here - return this.sharesTree['']?.find((s) => s.incoming) + return this.sharesTree['/']?.find((s) => s.incoming) }, allowCustomSharing() { return this.capabilities?.files_sharing?.allow_custom diff --git a/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue b/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue index e527a9967c7..dd2ed57ef7e 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue @@ -184,7 +184,7 @@ export default defineComponent({ share() { // the root share has an empty key in the shares tree. That's the reason why we retrieve the share by an empty key here - return this.sharesTree['']?.find((s) => s.incoming) + return this.sharesTree['/']?.find((s) => s.incoming) }, expirationDate() { diff --git a/packages/web-app-files/src/helpers/path.js b/packages/web-app-files/src/helpers/path.js index cf91b694633..a2a186f0699 100644 --- a/packages/web-app-files/src/helpers/path.js +++ b/packages/web-app-files/src/helpers/path.js @@ -21,12 +21,16 @@ export function getParentPaths(path = '', includeCurrent = false) { const paths = [] const sections = s.split('/') - if (includeCurrent) { + if (includeCurrent && s) { paths.push(s) } sections.pop() while (sections.length > 0) { + if (!sections.join('/')) { + sections.pop() + continue + } paths.push(sections.join('/')) sections.pop() }