Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add resource name to the WebDAV properties #7485

Merged
merged 3 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Add resource name to the WebDAV properties

We've added the resource name to the WebDAV properties.

https://github.com/owncloud/web/pull/7485
5 changes: 3 additions & 2 deletions packages/web-app-files/src/helpers/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export function renameResource(resource, newName, newPath) {
}

export function buildResource(resource): Resource {
const name = resource.fileInfo[DavProperty.Name] || path.basename(resource.name)
const isFolder = resource.type === 'dir' || resource.type === 'folder'
const extension = extractExtensionFromFile(resource)
const extension = extractExtensionFromFile({ ...resource, name })
let resourcePath

if (resource.name.startsWith('/files') || resource.name.startsWith('/space')) {
Expand All @@ -55,7 +56,7 @@ export function buildResource(resource): Resource {
fileId: resource.fileInfo[DavProperty.FileId],
storageId: extractStorageId(resource.fileInfo[DavProperty.FileId]),
mimeType: resource.fileInfo[DavProperty.MimeType],
name: path.basename(resource.name),
name,
extension: isFolder ? '' : extension,
path: resourcePath,
webDavPath: resource.name,
Expand Down
2 changes: 2 additions & 0 deletions packages/web-pkg/src/constants/dav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export abstract class DavProperty {
static readonly Permissions: string = '{http://owncloud.org/ns}permissions'
static readonly IsFavorite: string = '{http://owncloud.org/ns}favorite'
static readonly FileId: string = '{http://owncloud.org/ns}fileid'
static readonly Name: string = '{http://owncloud.org/ns}name'
static readonly OwnerId: string = '{http://owncloud.org/ns}owner-id'
static readonly OwnerDisplayName: string = '{http://owncloud.org/ns}owner-display-name'
static readonly PrivateLink: string = '{http://owncloud.org/ns}privatelink'
Expand Down Expand Up @@ -49,6 +50,7 @@ export abstract class DavProperties {
DavProperty.Permissions,
DavProperty.IsFavorite,
DavProperty.FileId,
DavProperty.Name,
DavProperty.OwnerId,
DavProperty.OwnerDisplayName,
DavProperty.ShareTypes,
Expand Down