Skip to content

Commit

Permalink
fix(dav): Add displayname and creationdate to default props
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Jun 18, 2024
1 parent 0b7d744 commit 5ecd5e3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
23 changes: 23 additions & 0 deletions __tests__/dav/davProperties.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,27 @@ describe('DAV Properties', () => {
expect(logger.warn).not.toBeCalled()
expect(getDavProperties().includes('my:prop')).toBe(false)
})

test('default properties include all RFC DAV properties', () => {
// Refer to http://www.webdav.org/specs/rfc2518.html#dav.properties
const rfc2518 = [
'd:creationdate',
'd:displayname',
'd:getcontentlength',
'd:getcontenttype',
'd:getetag',
'd:getlastmodified',
'd:resourcetype',
// Nextcloud autmatically includes:
// 'd:source'
// Only valid for GET requests
// 'd:getcontentlanguage',
// Not used by default (stub implemented)
// 'd:supportedlock'
// 'd:lockdiscovery'
]

const missing = rfc2518.filter((prop) => !defaultDavProperties.includes(prop))
expect(missing, 'RFC defined prop not included in default DAV properties').toEqual([])
})
})
2 changes: 2 additions & 0 deletions lib/dav/davProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export const defaultDavProperties = [
'd:getcontenttype',
'd:getetag',
'd:getlastmodified',
'd:creationdate',
'd:displayname',
'd:quota-available-bytes',
'd:resourcetype',
'nc:has-preview',
Expand Down

0 comments on commit 5ecd5e3

Please sign in to comment.