New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

webdav

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webdav - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

2

API.md

@@ -517,3 +517,3 @@ ## Modules

| basename | <code>String</code> | The base filename of the remote item, without the path |
| lastmod | <code>String</code> | The last modification date (eg. "Sun, 13 Mar 2016 04:23:32 GMT") |
| lastmod | <code>String</code> \| <code>null</code> | The last modification date (eg. "Sun, 13 Mar 2016 04:23:32 GMT") |
| size | <code>Number</code> | The size of the remote item |

@@ -520,0 +520,0 @@ | type | <code>String</code> | The type of the item (file/directory) |

# WebDAV-Client changelog
## v3.1.0
_2020-02-05_
* Improved parsing logic for more robust handling of various PROPFIND requests
* **Bugfix**:
* [#194](https://github.com/perry-mitchell/webdav-client/issues/194) Several properties not defined in directory-contents / stats payloads
* [#147](https://github.com/perry-mitchell/webdav-client/issues/147) `Content-length` header being attached to stream requests erroneously
## v3.0.0

@@ -4,0 +12,0 @@ _2020-01-26_

@@ -81,3 +81,3 @@ "use strict";

* @property {String} basename The base filename of the remote item, without the path
* @property {String} lastmod The last modification date (eg. "Sun, 13 Mar 2016 04:23:32 GMT")
* @property {String|null} lastmod The last modification date (eg. "Sun, 13 Mar 2016 04:23:32 GMT")
* @property {Number} size The size of the remote item

@@ -84,0 +84,0 @@ * @property {String} type The type of the item (file/directory)

@@ -5,2 +5,37 @@ "use strict";

const nestedProp = require("nested-property");
function getPropertyOfType(obj, prop, type) {
const val = nestedProp.get(obj, prop);
if (type === "array" && Array.isArray(val) === false) {
return [val];
} else if (type === "object" && Array.isArray(val)) {
return val[0];
}
return val;
}
function normaliseResponse(response) {
const output = Object.assign({}, response);
nestedProp.set(output, "propstat", getPropertyOfType(output, "propstat", "object"));
nestedProp.set(output, "propstat.prop", getPropertyOfType(output, "propstat.prop", "object"));
return output;
}
function normaliseResult(result) {
const multistatus = result.multistatus;
if (!multistatus) {
throw new Error("Invalid response: No root multistatus found");
}
const output = {};
output.multistatus = Array.isArray(multistatus) ? multistatus[0] : multistatus;
nestedProp.set(output, "multistatus.response", getPropertyOfType(output, "multistatus.response", "array"));
nestedProp.set(output, "multistatus.response", nestedProp.get(output, "multistatus.response").map(response => normaliseResponse(response)));
return output;
}
function parseXML(xml) {

@@ -12,3 +47,3 @@ return new Promise(resolve => {

});
resolve(result);
resolve(normaliseResult(result));
});

@@ -21,8 +56,12 @@ }

const lastMod = props.getlastmodified,
const _props$getlastmodifie = props.getlastmodified,
lastMod = _props$getlastmodifie === void 0 ? null : _props$getlastmodifie,
_props$getcontentleng = props.getcontentlength,
rawSize = _props$getcontentleng === void 0 ? "0" : _props$getcontentleng,
resourceType = props.resourcetype,
mimeType = props.getcontenttype,
etag = props.getetag;
_props$resourcetype = props.resourcetype,
resourceType = _props$resourcetype === void 0 ? null : _props$resourcetype,
_props$getcontenttype = props.getcontenttype,
mimeType = _props$getcontenttype === void 0 ? null : _props$getcontenttype,
_props$getetag = props.getetag,
etag = _props$getetag === void 0 ? null : _props$getetag;
const type = resourceType && typeof resourceType === "object" && typeof resourceType.collection !== "undefined" ? "directory" : "file";

@@ -29,0 +68,0 @@ const stat = {

@@ -27,6 +27,20 @@ "use strict";

function putFileContents(filePath, data, options) {
const headers = {
"Content-Length": data.length
};
if (typeof WEB === "undefined") {
// We're running under NodeJS, so it's safe to check if the
// input is a stream
const stream = require("stream");
if (data instanceof stream.Readable) {
// Input was a stream, remove the content length as this
// is not known yet
delete headers["Content-Length"];
}
}
const putOptions = merge(getPutContentsDefaults(), {
headers: {
"Content-Length": data.length
}
headers
}, options || {});

@@ -33,0 +47,0 @@

"use strict";
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
const _require = require("../response.js"),

@@ -37,3 +45,5 @@ handleResponseCode = _require.handleResponseCode,

try {
const responseItem = result.multistatus.response;
const _result$multistatus$r = _slicedToArray(result.multistatus.response, 1),
responseItem = _result$multistatus$r[0];
const _responseItem$propsta = responseItem.propstat.prop,

@@ -40,0 +50,0 @@ quotaUsed = _responseItem$propsta["quota-used-bytes"],

@@ -44,3 +44,3 @@ "use strict";

try {
responseItem = result.multistatus.response;
responseItem = result.multistatus.response[0];
} catch (e) {

@@ -47,0 +47,0 @@ /* ignore */

{
"name": "webdav",
"version": "3.0.0",
"version": "3.1.0",
"description": "WebDAV client for NodeJS",

@@ -59,2 +59,3 @@ "main": "dist/node/index.js",

"minimatch": "^3.0.4",
"nested-property": "^1.0.4",
"path-posix": "^1.0.0",

@@ -61,0 +62,0 @@ "url-join": "^4.0.1",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc