diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/caldav/request/resources.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/caldav/request/resources.js b/lib/caldav/request/resources.js index 1df7cf1..f66a455 100644 --- a/lib/caldav/request/resources.js +++ b/lib/caldav/request/resources.js @@ -2,14 +2,14 @@ var Propfind = ns.require('request/propfind'); - function ResourceFinder(connection, options) { + function Resources(connection, options) { Propfind.apply(this, arguments); this._resources = {}; this.depth = 1; } - ResourceFinder.prototype = { + Resources.prototype = { __proto__: Propfind.prototype, addResource: function(name, handler) { @@ -22,6 +22,7 @@ var root; var collection; var self = this; + var resources; if ('multistatus' in this.sax.root) { root = this.sax.root.multistatus; @@ -29,8 +30,11 @@ for (url in root) { collection = root[url]; - if ('resourcetype' in collection) { - collection.resourcetype.forEach(function(type) { + resources = collection.resourcetype; + + if (resources.value.forEach) { + + resources.value.forEach(function(type) { if (type in self._resources) { if (!(type in results)) { @@ -59,7 +63,7 @@ }; - module.exports = ResourceFinder; + module.exports = Resources; }.apply( this, |