Skip to content

Commit

Permalink
Fix webDavPath for resources shared via alias link
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Aug 24, 2022
1 parent 51d40b0 commit ad964ee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,15 @@ export default defineComponent({
}
},
computed: {
currentLinkRole() {
return LinkShareRoles.getByBitmask(parseInt(this.link.permissions), this.isFolderShare)
},
currentLinkRoleDescription() {
return LinkShareRoles.getByBitmask(
parseInt(this.link.permissions),
this.isFolderShare
).description(false)
return this.currentLinkRole.description(false)
},
currentLinkRoleLabel() {
return LinkShareRoles.getByBitmask(parseInt(this.link.permissions), this.isFolderShare).label
return this.currentLinkRole.label
},
editOptions() {
Expand Down Expand Up @@ -385,9 +385,7 @@ export default defineComponent({
},
isAliasLink() {
return [linkRoleInternalFolder.label, linkRoleInternalFile.label].includes(
this.link.description
)
return [linkRoleInternalFolder, linkRoleInternalFile].includes(this.currentLinkRole)
}
},
watch: {
Expand Down
12 changes: 11 additions & 1 deletion packages/web-app-files/src/helpers/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ export function buildResource(resource): Resource {
}

const id = resource.fileInfo[DavProperty.FileId]
const idComponent = resource.name.split('/')[2]
let webDavPath
if (idComponent?.includes('!')) {
// idComponent includes the opaqueID which represents the resource name.
// For the webdav path, we need to replace the opaqueID with the actual resource name.
const withoutOpaqueId = resource.name.split('!')[0]
webDavPath = `${withoutOpaqueId}/${name}`
} else {
webDavPath = resource.name
}

return {
id,
Expand All @@ -59,7 +69,7 @@ export function buildResource(resource): Resource {
name,
extension: isFolder ? '' : extension,
path: resourcePath,
webDavPath: resource.name,
webDavPath,
type: isFolder ? 'folder' : resource.type,
isFolder,
mdate: resource.fileInfo[DavProperty.LastModifiedDate],
Expand Down

0 comments on commit ad964ee

Please sign in to comment.