From c1ecbf51a40dfe846985fbd05469a8d32e501fb2 Mon Sep 17 00:00:00 2001 From: yueduz Date: Mon, 24 Jul 2017 23:53:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E7=A7=BB=E5=8A=A8=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=BF=A1=E6=81=AF=E4=B8=BA=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0srever=E9=80=89=E9=A1=B9=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E5=90=AF=E5=8A=A8=E8=87=AA=E5=B8=A6http=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E3=80=82=20Instead=20of=20starting=20the=20native=20H?= =?UTF-8?q?TTP=20service=20when=20adding=20the=20srever=20option,=20change?= =?UTF-8?q?=20the=20file=20back=20to=20the=20message=20object.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/DAV/handler.js | 20 ++++++++++---------- lib/DAV/server.js | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/DAV/handler.js b/lib/DAV/handler.js index 8440d4d2..42101b7e 100644 --- a/lib/DAV/handler.js +++ b/lib/DAV/handler.js @@ -185,7 +185,7 @@ jsDAV_Handler.STATUS_MAP = { // RFC5397 "{DAV:}current-user-principal" ]; - + /** * This property allows you to automatically add the 'resourcetype' value * based on a node's classname or interface. @@ -332,7 +332,7 @@ jsDAV_Handler.STATUS_MAP = { cbgetnodefp(null, node); }); }; - + /** * This method is called with every tree update * @@ -856,7 +856,7 @@ jsDAV_Handler.STATUS_MAP = { this.httpPut = function() { var self = this; var uri = this.getRequestUri(); - + // Intercepting Content-Range if (this.httpRequest.headers["content-range"]) { /* @@ -1089,7 +1089,7 @@ jsDAV_Handler.STATUS_MAP = { self.httpResponse.writeHead(moveInfo.destinationExists ? 204 : 201, {"content-length": "0"}); self.httpResponse.end(); - self.dispatchEvent("afterMove", moveInfo.destination); + self.dispatchEvent("afterMove", {source: moveInfo.source,destination: moveInfo.destination}); }); }); }); @@ -1242,7 +1242,7 @@ jsDAV_Handler.STATUS_MAP = { var ctype; var self = this; var req = this.httpRequest; - var isStream = forceStream === true + var isStream = forceStream === true ? true : (!(ctype = req.headers["content-type"]) || !ctype.match(/(urlencoded|multipart)/i)); @@ -1437,7 +1437,7 @@ jsDAV_Handler.STATUS_MAP = { for (var i = 0, l = ifMatch.length; i < l; ++i) { // Stripping any extra spaces ifMatchItem = Util.trim(ifMatch[i], " "); - + if (etag === ifMatchItem) { haveMatch = true; break; @@ -1762,8 +1762,8 @@ jsDAV_Handler.STATUS_MAP = { "{DAV:}getcontenttype" ]; } - - + + // If the resourceType was not part of the list, we manually add it // and mark it for removal. We need to know the resourcetype in order // to make certain decisions about the entry. @@ -1822,7 +1822,7 @@ jsDAV_Handler.STATUS_MAP = { "403" : {}, "404" : {} }; - + var myProperties = [].concat(propertyNames); var propertyMap = Util.arrayToMap(myProperties); @@ -2427,7 +2427,7 @@ jsDAV_Handler.STATUS_MAP = { }); }); } - + function onDone() { self.markDirty(parentUri); self.dispatchEvent("afterBind", uri, Path.join(parent.path, newName)); diff --git a/lib/DAV/server.js b/lib/DAV/server.js index 9c172205..1fe1d9c8 100644 --- a/lib/DAV/server.js +++ b/lib/DAV/server.js @@ -168,6 +168,7 @@ function Server(options) { } }); } + return options.server; } else { this.setBaseUri(this.guessBaseUri());