Skip to content

Commit

Permalink
update webdav.getProperties to return all requested properties
Browse files Browse the repository at this point in the history
  • Loading branch information
VicDeo committed Sep 25, 2019
1 parent 899ad1e commit da3d91c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tests/acceptance/helpers/webdavHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,22 +173,20 @@ exports.createFile = function (user, fileName, contents = '') {
*
* @param {string} path
* @param {string} userId
* @param {array} properties
* @param {array} requestedProps
* @param {number} folderDepth
*/
exports.getProperties = function (path, userId, properties, folderDepth = 1) {
exports.getProperties = function (path, userId, requestedProps, folderDepth = 1) {
return new Promise((resolve) => {
exports.propfind(`/files/${userId}${path}`, userId, userSettings.getPasswordForUser(userId), properties,
exports.propfind(`/files/${userId}${path}`, userId, userSettings.getPasswordForUser(userId), requestedProps,
folderDepth)
.then(str => {
const response = JSON.parse(convert.xml2json(str, { compact: true }))['d:multistatus']['d:response']
const items = []
response.map(item => {
items.push({
privatelink: item['d:propstat']['d:prop']['oc:privatelink']
})
const properties = {}
requestedProps.map(propertyName => {
properties[propertyName] = response['d:propstat']['d:prop'][propertyName]._text
})
resolve(items)
resolve(properties)
})
})
}

0 comments on commit da3d91c

Please sign in to comment.