Skip to content

Commit

Permalink
Fix sharesTree loading
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Sep 7, 2022
1 parent 31950dc commit 684a466
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 5 additions & 1 deletion packages/web-app-files/src/helpers/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit 684a466

Please sign in to comment.