webdav-test
Advanced tools
Comparing version 1.5.3 to 1.5.5
# WebDAV-client changelog | ||
## 1.5.2 | ||
_2018-03-25_ | ||
* Fix bug where requesting directory contents at paths with trailing slashes would return parent directory in results | ||
## 1.5.1 | ||
@@ -9,0 +4,0 @@ _2018-03-23_ |
@@ -38,8 +38,2 @@ "use strict"; | ||
/** | ||
* Options with headers and format | ||
* @typedef {OptionsWithHeaders} OptionsHeadersAndFormat | ||
* @property {String} format - The format to use (text/binary) | ||
*/ | ||
/** | ||
* Create a client adapter | ||
@@ -66,4 +60,3 @@ * @param {String} remoteURL The remote address of the webdav server | ||
* console.log(contents); | ||
* }); | ||
*/ | ||
* }); */ | ||
function createClient(remoteURL, username, password) { | ||
@@ -221,15 +214,2 @@ var baseOptions = { | ||
/** | ||
* Get the upload link | ||
* Only supported for Basic authentication or unauthenticated connections. | ||
* @param {String} remoteFilename The path of the remote file location | ||
* @param {PutOptions=} options The options for the request | ||
* @memberof ClientInterface | ||
* @returns {String} A upload URL | ||
*/ | ||
getFileUploadLink: function getFileUploadLink(remoteFilename, options) { | ||
var putOptions = merge(baseOptions, options || {}); | ||
return putFile.getFileUploadLink(remoteFilename, putOptions); | ||
}, | ||
/** | ||
* Stat a remote object | ||
@@ -236,0 +216,0 @@ * @param {String} remotePath The path of the item |
@@ -36,20 +36,4 @@ "use strict"; | ||
function getFileUploadLink(filePath, options) { | ||
var fetchURL = joinURL(options.remoteURL, encodePath(filePath)); | ||
fetchURL += "?Content-Type=application/octet-stream"; | ||
var protocol = /^https:/i.test(fetchURL) ? "https" : "http"; | ||
if (options.headers.Authorization) { | ||
if (/^Basic /i.test(options.headers.Authorization) === false) { | ||
throw new Error("Failed retrieving download link: Invalid authorisation method"); | ||
} | ||
var authPart = options.headers.Authorization.replace(/^Basic /i, "").trim(); | ||
var authContents = Buffer.from(authPart, "base64").toString("utf8"); | ||
fetchURL = fetchURL.replace(/^https?:\/\//, `${protocol}://${authContents}@`); | ||
} | ||
return fetchURL; | ||
} | ||
module.exports = { | ||
getFileUploadLink, | ||
putFileContents | ||
putFileContents: putFileContents | ||
}; |
{ | ||
"name": "webdav-test", | ||
"version": "1.5.3", | ||
"version": "1.5.5", | ||
"description": "WebDAV client for NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -110,3 +110,3 @@ ![WebDAV](https://raw.githubusercontent.com/perry-mitchell/webdav-client/master/webdav.jpg) | ||
client | ||
.getFileContents("/doc.txt", { format: "text" }) | ||
.getFileContents("/doc.txt", "text") | ||
.then(function(text) { | ||
@@ -113,0 +113,0 @@ console.log(text); |
59635
781