Skip to content

Commit 2fef8fe

Browse files
committed
fixed webdav callbacks on error
1 parent 9a57ae6 commit 2fef8fe

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

elements/webdav.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ apf.webdav = function(struct, tagName){
499499
if (this.dispatchEvent("error", {
500500
error : oError,
501501
bubbles : true
502-
}) === false)
502+
}) === false && callback)
503503
callback(oError);
504504
}
505505
}, sPath, null, bLock && oLock.token
@@ -549,7 +549,7 @@ apf.webdav = function(struct, tagName){
549549
bubbles : true
550550
}) === false)
551551
throw oError;
552-
callback.call(this, data, apf.ERROR, extra);
552+
callback && callback.call(this, data, apf.ERROR, extra);
553553
}
554554
else {
555555
_self.getProperties(sPath, 0, callback);
@@ -664,7 +664,7 @@ apf.webdav = function(struct, tagName){
664664
delete this.$fsCache[sFrom];
665665
}
666666
}
667-
callback.call(this, data, state, extra);
667+
callback && callback.call(this, data, state, extra);
668668
}, sFrom, null, oHeaders);
669669
};
670670

@@ -697,7 +697,7 @@ apf.webdav = function(struct, tagName){
697697
}) === false)
698698
throw oError;
699699
}
700-
callback.call(this, data, state, extra);
700+
callback && callback.call(this, data, state, extra);
701701
}, sPath, null, bLock && oLock.token
702702
? {"If": "<" + oLock.token + ">"}
703703
: null);
@@ -728,7 +728,7 @@ apf.webdav = function(struct, tagName){
728728
}) === false)
729729
throw oError;
730730
}
731-
callback.call(this, data, state, extra);
731+
callback && callback.call(this, data, state, extra);
732732
}, sPath, aCont.join(""));
733733
};
734734

@@ -1021,8 +1021,7 @@ apf.webdav = function(struct, tagName){
10211021
for (var i = 1, j = aResp.length; i < j; i++)
10221022
aOut.push(parseItem.call(this, aResp[i]));
10231023

1024-
if (callback)
1025-
callback.call(this, "<files>" + aOut.join("") + "</files>", state, extra);
1024+
callback && callback.call(this, "<files>" + aOut.join("") + "</files>", state, extra);
10261025
}
10271026

10281027
/*
@@ -1082,7 +1081,7 @@ apf.webdav = function(struct, tagName){
10821081
extra.originalArgs = args
10831082
if (typeof args[args.length - 1] == "function")
10841083
args[args.length - 1](data, state, extra);
1085-
callback(data, state, extra);
1084+
callback && callback(data, state, extra);
10861085
};
10871086
// RULE for case aliases: first, topmost match is the preferred term for any
10881087
// action and should be used in demos/ examples in

0 commit comments

Comments
 (0)