Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(options) {
super(options);
const client = new Webdav(
options.connection.credentials.server,
options.connection.credentials.username,
options.connection.credentials.password,
);
options.getPath = function(file) {
if (options.uploadFolderPath[options.uploadFolderPath.length - 1] !== '/') {
options.uploadFolderPath += '/';
}
return options.uploadFolderPath + file._id;
};
client.stat(options.uploadFolderPath).catch(function(err) {
if (err.status === '404') {
client.createDirectory(options.uploadFolderPath);
}