diff --git a/lib/server/v2/commands/Get.js b/lib/server/v2/commands/Get.js
index cc9e25b5..be558897 100644
--- a/lib/server/v2/commands/Get.js
+++ b/lib/server/v2/commands/Get.js
@@ -12,33 +12,6 @@ var __extends = (this && this.__extends) || (function () {
Object.defineProperty(exports, "__esModule", { value: true });
var WebDAVRequest_1 = require("../WebDAVRequest");
var stream_1 = require("stream");
-var MultipleRangedStream = (function (_super) {
- __extends(MultipleRangedStream, _super);
- function MultipleRangedStream(ranges) {
- var _this = _super.call(this) || this;
- _this.ranges = ranges;
- _this.streams = ranges.map(function (r) {
- return {
- stream: new RangedStream(r.min, r.max),
- range: r
- };
- });
- return _this;
- }
- MultipleRangedStream.prototype._transform = function (chunk, encoding, callback) {
- this.streams.forEach(function (streamRange) {
- streamRange.stream.write(chunk, encoding);
- });
- callback(null, new Buffer(0));
- };
- MultipleRangedStream.prototype.end = function (chunk, encoding, cb) {
- var _this = this;
- if (this.onEnded)
- process.nextTick(function () { return _this.onEnded(); });
- _super.prototype.end.call(this, chunk, encoding, cb);
- };
- return MultipleRangedStream;
-}(stream_1.Transform));
var RangedStream = (function (_super) {
__extends(RangedStream, _super);
function RangedStream(min, max) {
@@ -73,16 +46,49 @@ var RangedStream = (function (_super) {
};
return RangedStream;
}(stream_1.Transform));
+var MultipleRangedStream = (function (_super) {
+ __extends(MultipleRangedStream, _super);
+ function MultipleRangedStream(ranges) {
+ var _this = _super.call(this) || this;
+ _this.ranges = ranges;
+ _this.streams = ranges.map(function (r) {
+ return {
+ stream: new RangedStream(r.min, r.max),
+ range: r
+ };
+ });
+ return _this;
+ }
+ MultipleRangedStream.prototype._transform = function (chunk, encoding, callback) {
+ this.streams.forEach(function (streamRange) {
+ streamRange.stream.write(chunk, encoding);
+ });
+ callback(null, new Buffer(0));
+ };
+ MultipleRangedStream.prototype.end = function (chunk, encoding, cb) {
+ var _this = this;
+ if (this.onEnded)
+ process.nextTick(function () { return _this.onEnded(); });
+ _super.prototype.end.call(this, chunk, encoding, cb);
+ };
+ return MultipleRangedStream;
+}(stream_1.Transform));
function parseRangeHeader(mimeType, size, range) {
+ var separator = Array.apply(null, { length: 20 })
+ .map(function () { return String.fromCharCode('a'.charCodeAt(0) + Math.floor(Math.random() * 26)); })
+ .join('');
var createMultipart = function (range) {
- return '--' + separator + '\r\nContent-Type: ' + mimeType + '\r\nContent-Range: bytes ' + range.min + '-' + range.max + '/*\r\n\r\n';
+ return "--" + separator + "\r\nContent-Type: " + mimeType + "\r\nContent-Range: bytes " + range.min + "-" + range.max + "/*\r\n\r\n";
};
var endMultipart = function () {
- return '\r\n--' + separator + '--';
+ return "\r\n--" + separator + "--";
};
- var ranges = range.split(',').map(function (block) { return parseRangeBlock(size, block); });
- var separator = Array.apply(null, { length: 20 }).map(function () { return String.fromCharCode('a'.charCodeAt(0) + Math.floor(Math.random() * 26)); }).join('');
- var len = ranges.reduce(function (previous, mm) { return mm.max - mm.min + 1 + previous; }, 0) + (ranges.length > 1 ? ranges.reduce(function (previous, mm) { return createMultipart(mm).length + previous; }, endMultipart().length + '\r\n'.length * (ranges.length - 1)) : 0);
+ var ranges = range
+ .split(',')
+ .map(function (block) { return parseRangeBlock(size, block); });
+ var len = ranges.reduce(function (previous, mm) { return mm.max - mm.min + 1 + previous; }, 0)
+ + (ranges.length <= 1 ?
+ 0 : ranges.reduce(function (previous, mm) { return createMultipart(mm).length + previous; }, endMultipart().length + '\r\n'.length * (ranges.length - 1)));
return {
ranges: ranges,
separator: separator,
@@ -164,11 +170,11 @@ var default_1 = (function () {
ctx.response.setHeader('Content-Length', len.toString());
if (ranges_1.length <= 1) {
ctx.response.setHeader('Content-Type', mimeType);
- ctx.response.setHeader('Content-Range', 'bytes ' + ranges_1[0].min + '-' + ranges_1[0].max + '/*');
+ ctx.response.setHeader('Content-Range', "bytes " + ranges_1[0].min + "-" + ranges_1[0].max + "/*");
rstream.on('end', callback);
return rstream.pipe(new RangedStream(ranges_1[0].min, ranges_1[0].max)).pipe(ctx.response);
}
- ctx.response.setHeader('Content-Type', 'multipart/byteranges; boundary=' + separator);
+ ctx.response.setHeader('Content-Type', "multipart/byteranges; boundary=" + separator);
var multi_1 = new MultipleRangedStream(ranges_1);
rstream.pipe(multi_1);
var current_1 = 0;
diff --git a/lib/server/v2/commands/Head.js b/lib/server/v2/commands/Head.js
index b53cab4a..77704919 100644
--- a/lib/server/v2/commands/Head.js
+++ b/lib/server/v2/commands/Head.js
@@ -41,10 +41,10 @@ var default_1 = (function () {
ctx.response.setHeader('Content-Length', len.toString());
if (ranges.length <= 1) {
ctx.response.setHeader('Content-Type', mimeType);
- ctx.response.setHeader('Content-Range', 'bytes ' + ranges[0].min + '-' + ranges[0].max + '/*');
+ ctx.response.setHeader('Content-Range', "bytes " + ranges[0].min + "-" + ranges[0].max + "/*");
}
else
- ctx.response.setHeader('Content-Type', 'multipart/byteranges; boundary=' + separator);
+ ctx.response.setHeader('Content-Type', "multipart/byteranges; boundary=" + separator);
}
catch (ex) {
ctx.setCode(WebDAVRequest_1.HTTPCodes.BadRequest);
diff --git a/lib/server/v2/commands/Lock.js b/lib/server/v2/commands/Lock.js
index 193cf20d..4a7980c4 100644
--- a/lib/server/v2/commands/Lock.js
+++ b/lib/server/v2/commands/Lock.js
@@ -21,7 +21,7 @@ function createResponse(ctx, lock) {
activelock.ele('D:depth').add(lock.depth === -1 ? 'infinity' : lock.depth.toString());
if (lock.owner)
activelock.ele('D:owner').add(lock.owner);
- activelock.ele('D:timeout').add('Second-' + lock.lockKind.timeout);
+ activelock.ele('D:timeout').add("Second-" + lock.lockKind.timeout);
return prop;
}
function createLock(ctx, data, callback) {
@@ -42,8 +42,8 @@ function createLock(ctx, data, callback) {
if (Object.keys(locks).length > 0) {
if (LockScope_1.LockScope.Exclusive.isSame(type_1))
return callback(Errors_1.Errors.Locked);
- for (var path_1 in locks)
- if (locks[path_1].some(function (l) { return LockScope_1.LockScope.Exclusive.isSame(l.lockKind.scope); }))
+ for (var path in locks)
+ if (locks[path].some(function (l) { return LockScope_1.LockScope.Exclusive.isSame(l.lockKind.scope); }))
return callback(Errors_1.Errors.Locked);
}
r.lockManager(function (e, lm) {
diff --git a/lib/server/v2/commands/Propfind.js b/lib/server/v2/commands/Propfind.js
index 54722b7a..f872eb21 100644
--- a/lib/server/v2/commands/Propfind.js
+++ b/lib/server/v2/commands/Propfind.js
@@ -61,7 +61,7 @@ function parseRequestBody(ctx, data) {
}
}
function propstatStatus(status) {
- return 'HTTP/1.1 ' + status + ' ' + http.STATUS_CODES[status];
+ return "HTTP/1.1 " + status + " " + http.STATUS_CODES[status];
}
var default_1 = (function () {
function default_1() {
@@ -78,7 +78,7 @@ var default_1 = (function () {
var errorNumber = WebDAVRequest_1.HTTPRequestContext.defaultStatusCode(e);
if (errorNumber !== null) {
var response_1 = new xml_js_builder_1.XMLElementBuilder('D:response');
- response_1.ele('D:propstat').ele('D:status').add('HTTP/1.1 ' + errorNumber + ' ' + http.STATUS_CODES[errorNumber]);
+ response_1.ele('D:propstat').ele('D:status').add("HTTP/1.1 " + errorNumber + " " + http.STATUS_CODES[errorNumber]);
resource.fs.getFullPath(ctx, resource.path, function (e, path) {
if (e)
return nbOut(e);
@@ -161,7 +161,7 @@ var default_1 = (function () {
activelock.ele('D:depth').add('Infinity');
if (lock.owner)
activelock.ele('D:owner').add(lock.owner);
- activelock.ele('D:timeout').add('Second-' + (lock.expirationDate - Date.now()));
+ activelock.ele('D:timeout').add("Second-" + (lock.expirationDate - Date.now()));
activelock.ele('D:locktoken').ele('D:href', undefined, true).add(lock.uuid);
activelock.ele('D:lockroot').ele('D:href', undefined, true).add(WebDAVRequest_1.HTTPRequestContext.encodeURL(ctx.fullUri(path)));
}
@@ -276,7 +276,6 @@ var default_1 = (function () {
default_1.prototype.unchunked = function (ctx, data, callback) {
var _this = this;
ctx.getResource(function (e, resource) {
- var lockDiscoveryCache = {};
ctx.checkIfHeader(resource, function () {
var multistatus = new xml_js_builder_1.XMLElementBuilder('D:multistatus', {
'xmlns:D': 'DAV:'
diff --git a/lib/server/v2/commands/Proppatch.js b/lib/server/v2/commands/Proppatch.js
index 127f7f48..2565d7d4 100644
--- a/lib/server/v2/commands/Proppatch.js
+++ b/lib/server/v2/commands/Proppatch.js
@@ -1,9 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var WebDAVRequest_1 = require("../WebDAVRequest");
+var xml_js_builder_1 = require("xml-js-builder");
var http_1 = require("http");
var Workflow_1 = require("../../../helper/Workflow");
-var xml_js_builder_1 = require("xml-js-builder");
var Errors_1 = require("../../../Errors");
var default_1 = (function () {
function default_1() {
diff --git a/lib/server/v2/webDAVServer/Persistence.d.ts b/lib/server/v2/webDAVServer/Persistence.d.ts
index 4248a8b8..ff5b3df2 100644
--- a/lib/server/v2/webDAVServer/Persistence.d.ts
+++ b/lib/server/v2/webDAVServer/Persistence.d.ts
@@ -1,6 +1,6 @@
-import { SimpleCallback } from '../../../manager/v2/fileSystem/CommonTypes';
import { FileSystemSerializer, SerializedData } from '../../../manager/v2/fileSystem/Serialization';
import { IAutoSave } from '../WebDAVServerOptions';
+import { SimpleCallback } from '../../../manager/v2/fileSystem/CommonTypes';
export declare function load(data: SerializedData, serializers: FileSystemSerializer[], callback: (error: Error) => void): void;
export declare function autoLoad(callback: SimpleCallback): void;
export declare function save(callback: (error: Error, obj: SerializedData) => void): void;
diff --git a/lib/server/v2/webDAVServer/Persistence.js b/lib/server/v2/webDAVServer/Persistence.js
index 605334f1..711b0db4 100644
--- a/lib/server/v2/webDAVServer/Persistence.js
+++ b/lib/server/v2/webDAVServer/Persistence.js
@@ -1,8 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Serialization_1 = require("../../../manager/v2/fileSystem/Serialization");
-var VirtualFileSystem_1 = require("../../../manager/v2/instances/VirtualFileSystem");
var PhysicalFileSystem_1 = require("../../../manager/v2/instances/PhysicalFileSystem");
+var VirtualFileSystem_1 = require("../../../manager/v2/instances/VirtualFileSystem");
var zlib = require("zlib");
var fs = require("fs");
function defaultSerializers() {
diff --git a/lib/server/v2/webDAVServer/WebDAVServer.d.ts b/lib/server/v2/webDAVServer/WebDAVServer.d.ts
index 61954aa6..2075b43a 100644
--- a/lib/server/v2/webDAVServer/WebDAVServer.d.ts
+++ b/lib/server/v2/webDAVServer/WebDAVServer.d.ts
@@ -1,11 +1,11 @@
///
import { ExternalRequestContext, RequestContextExternalOptions, RequestContext } from '../RequestContext';
import { WebDAVServerOptions, IAutoSave } from '../WebDAVServerOptions';
-import { HTTPMethod } from '../WebDAVRequest';
import { HTTPAuthentication } from '../../../user/v2/authentication/HTTPAuthentication';
import { PrivilegeManager } from '../../../user/v2/privilege/PrivilegeManager';
-import { FileSystem } from '../../../manager/v2/fileSystem/FileSystem';
import { ReturnCallback } from '../../../manager/v2/fileSystem/CommonTypes';
+import { HTTPMethod } from '../WebDAVRequest';
+import { FileSystem } from '../../../manager/v2/fileSystem/FileSystem';
import { Resource } from '../../../manager/v2/fileSystem/Resource';
import { Path } from '../../../manager/v2/Path';
import * as persistence from './Persistence';
diff --git a/lib/user/v2/authentication/HTTPDigestAuthentication.js b/lib/user/v2/authentication/HTTPDigestAuthentication.js
index fbdf0e12..4a9ac602 100644
--- a/lib/user/v2/authentication/HTTPDigestAuthentication.js
+++ b/lib/user/v2/authentication/HTTPDigestAuthentication.js
@@ -21,7 +21,7 @@ var HTTPDigestAuthentication = (function () {
};
HTTPDigestAuthentication.prototype.askForAuthentication = function () {
return {
- 'WWW-Authenticate': 'Digest realm="' + this.realm + '", qop="auth", nonce="' + this.generateNonce() + '", opaque="' + this.generateNonce() + '"'
+ 'WWW-Authenticate': "Digest realm=\"" + this.realm + "\", qop=\"auth\", nonce=\"" + this.generateNonce() + "\", opaque=\"" + this.generateNonce() + "\""
};
};
HTTPDigestAuthentication.prototype.getUser = function (ctx, callback) {
@@ -51,19 +51,19 @@ var HTTPDigestAuthentication = (function () {
this.userManager.getUserByName(authProps.username, function (e, user) {
if (e)
return onError(e);
- var ha1 = md5(authProps.username + ':' + _this.realm + ':' + (user.password ? user.password : ''));
+ var ha1 = md5(authProps.username + ":" + _this.realm + ":" + (user.password ? user.password : ''));
if (authProps.algorithm === 'MD5-sess')
- ha1 = md5(ha1 + ':' + authProps.nonce + ':' + authProps.cnonce);
+ ha1 = md5(ha1 + ":" + authProps.nonce + ":" + authProps.cnonce);
var ha2;
if (authProps.qop === 'auth-int')
return onError(Errors_1.Errors.WrongHeaderFormat); // ha2 = md5(ctx.request.method.toString().toUpperCase() + ':' + ctx.requested.uri + ':' + md5(...));
else
- ha2 = md5(ctx.request.method.toString().toUpperCase() + ':' + ctx.requested.uri);
+ ha2 = md5(ctx.request.method.toString().toUpperCase() + ":" + ctx.requested.uri);
var result;
if (authProps.qop === 'auth-int' || authProps.qop === 'auth')
- result = md5(ha1 + ':' + authProps.nonce + ':' + authProps.nc + ':' + authProps.cnonce + ':' + authProps.qop + ':' + ha2);
+ result = md5(ha1 + ":" + authProps.nonce + ":" + authProps.nc + ":" + authProps.cnonce + ":" + authProps.qop + ":" + ha2);
else
- result = md5(ha1 + ':' + authProps.nonce + ':' + ha2);
+ result = md5(ha1 + ":" + authProps.nonce + ":" + ha2);
if (result.toLowerCase() === authProps.response.toLowerCase())
callback(Errors_1.Errors.None, user);
else
diff --git a/src/helper/v2/IfParser.ts b/src/helper/v2/IfParser.ts
index 774968c0..577c544a 100644
--- a/src/helper/v2/IfParser.ts
+++ b/src/helper/v2/IfParser.ts
@@ -1,7 +1,4 @@
import { RequestContext } from '../../server/v2/RequestContext'
-import { Errors } from '../../Errors'
-import { FileSystem } from '../../manager/v2/fileSystem/FileSystem'
-import { ContextualFileSystem } from '../../manager/v2/fileSystem/ContextualFileSystem'
import { ReturnCallback } from '../../index.v2';
import { Resource } from '../../manager/v2/fileSystem/Resource'
import { Path } from '../../manager/v2/Path'
diff --git a/src/manager/v2/Path.ts b/src/manager/v2/Path.ts
index 40aae5d7..5aced182 100644
--- a/src/manager/v2/Path.ts
+++ b/src/manager/v2/Path.ts
@@ -8,7 +8,7 @@ export class Path
if(path.constructor === String)
{
let sPath = path as string;
- let doubleIndex;
+ let doubleIndex : number;
while((doubleIndex = sPath.indexOf('//')) !== -1)
sPath = sPath.substr(0, doubleIndex) + sPath.substr(doubleIndex + 1);
this.paths = sPath.replace(/(^\/|\/$)/g, '').split('/');
diff --git a/src/manager/v2/fileSystem/CommonTypes.ts b/src/manager/v2/fileSystem/CommonTypes.ts
index b1ae3a60..5965ea40 100644
--- a/src/manager/v2/fileSystem/CommonTypes.ts
+++ b/src/manager/v2/fileSystem/CommonTypes.ts
@@ -1,16 +1,5 @@
import { ReturnCallback, SimpleCallback } from './CommonTypes'
-import { Readable, Writable } from 'stream'
-import { RequestContext } from '../../../server/v2/RequestContext'
import { XMLElement } from 'xml-js-builder'
-import { LockScope } from '../../../resource/v2/lock/LockScope'
-import { LockType } from '../../../resource/v2/lock/LockType'
-import { LockKind } from '../../../resource/v2/lock/LockKind'
-import { Workflow } from '../../../helper/Workflow'
-import { Errors } from '../../../Errors'
-import { Lock } from '../../../resource/v2/lock/Lock'
-import { Path } from '../Path'
-import * as mimeTypes from 'mime-types'
-import * as crypto from 'crypto'
export type SimpleCallback = (error ?: Error) => void;
export type ReturnCallback = (error ?: Error, data ?: T) => void;
diff --git a/src/manager/v2/fileSystem/ContextInfo.ts b/src/manager/v2/fileSystem/ContextInfo.ts
index 614ec678..f7ead27f 100644
--- a/src/manager/v2/fileSystem/ContextInfo.ts
+++ b/src/manager/v2/fileSystem/ContextInfo.ts
@@ -1,15 +1,6 @@
import { ResourceType, OpenWriteStreamMode } from './CommonTypes'
-import { Readable, Writable } from 'stream'
import { RequestContext } from '../../../server/v2/RequestContext'
-import { LockScope } from '../../../resource/v2/lock/LockScope'
-import { LockType } from '../../../resource/v2/lock/LockType'
-import { LockKind } from '../../../resource/v2/lock/LockKind'
-import { Workflow } from '../../../helper/Workflow'
-import { Errors } from '../../../Errors'
-import { Lock } from '../../../resource/v2/lock/Lock'
import { Path } from '../Path'
-import * as mimeTypes from 'mime-types'
-import * as crypto from 'crypto'
export interface IContextInfo
{
diff --git a/src/manager/v2/fileSystem/ContextualFileSystem.ts b/src/manager/v2/fileSystem/ContextualFileSystem.ts
index 6e631557..97cdd687 100644
--- a/src/manager/v2/fileSystem/ContextualFileSystem.ts
+++ b/src/manager/v2/fileSystem/ContextualFileSystem.ts
@@ -1,25 +1,3 @@
-import {
- AvailableLocksInfo,
- CopyInfo,
- CreateInfo,
- CreationDateInfo,
- DeleteInfo,
- DisplayNameInfo,
- ETagInfo,
- IContextInfo,
- LastModifiedDateInfo,
- LockManagerInfo,
- MimeTypeInfo,
- MoveInfo,
- OpenReadStreamInfo,
- OpenWriteStreamInfo,
- PropertyManagerInfo,
- ReadDirInfo,
- RenameInfo,
- SizeInfo,
- TypeInfo,
- WebNameInfo
-} from './ContextInfo'
import { ReturnCallback, SimpleCallback, Return2Callback, OpenWriteStreamMode, SubTree, ResourceType } from './CommonTypes'
import { FileSystemSerializer, ISerializableFileSystem } from './Serialization'
import { Readable, Writable } from 'stream'
@@ -27,18 +5,11 @@ import { IPropertyManager } from './PropertyManager'
import { RequestContext } from '../../../server/v2/RequestContext'
import { ILockManager } from './LockManager'
import { FileSystem } from './FileSystem'
-import { LockScope } from '../../../resource/v2/lock/LockScope'
import { Resource } from './Resource'
-import { LockType } from '../../../resource/v2/lock/LockType'
import { LockKind } from '../../../resource/v2/lock/LockKind'
-import { Workflow } from '../../../helper/Workflow'
-import { Errors } from '../../../Errors'
import { Lock } from '../../../resource/v2/lock/Lock'
import { Path } from '../Path'
-import * as mimeTypes from 'mime-types'
-import * as crypto from 'crypto'
-
export class ContextualFileSystem implements ISerializableFileSystem
{
constructor(public fs : FileSystem, public context : RequestContext)
diff --git a/src/manager/v2/fileSystem/FileSystem.ts b/src/manager/v2/fileSystem/FileSystem.ts
index 5abc92c5..18cd8ea8 100644
--- a/src/manager/v2/fileSystem/FileSystem.ts
+++ b/src/manager/v2/fileSystem/FileSystem.ts
@@ -7,7 +7,6 @@ import {
DeleteInfo,
DisplayNameInfo,
ETagInfo,
- IContextInfo,
LastModifiedDateInfo,
LockManagerInfo,
MimeTypeInfo,
@@ -18,8 +17,7 @@ import {
ReadDirInfo,
RenameInfo,
SizeInfo,
- TypeInfo,
- WebNameInfo
+ TypeInfo
} from './ContextInfo'
import {
ResourceType,
@@ -38,10 +36,8 @@ import { Readable, Writable, Transform } from 'stream'
import { IPropertyManager, PropertyBag } from './PropertyManager'
import { ContextualFileSystem } from './ContextualFileSystem'
import { StandardMethods } from './StandardMethods'
-import { IStorageManager } from './StorageManager'
import { RequestContext } from '../../../server/v2/RequestContext'
import { ILockManager } from './LockManager'
-import { XMLElement } from 'xml-js-builder'
import { LockScope } from '../../../resource/v2/lock/LockScope'
import { LockType } from '../../../resource/v2/lock/LockType'
import { LockKind } from '../../../resource/v2/lock/LockKind'
@@ -50,7 +46,6 @@ import { Resource } from './Resource'
import { Errors } from '../../../Errors'
import { Lock } from '../../../resource/v2/lock/Lock'
import { Path } from '../Path'
-import * as mimeTypes from 'mime-types'
import * as crypto from 'crypto'
class BufferedIsLocked
diff --git a/src/manager/v2/fileSystem/LockManager.ts b/src/manager/v2/fileSystem/LockManager.ts
index d89f645e..719ae1b3 100644
--- a/src/manager/v2/fileSystem/LockManager.ts
+++ b/src/manager/v2/fileSystem/LockManager.ts
@@ -1,15 +1,5 @@
import { ReturnCallback, SimpleCallback } from './CommonTypes'
-import { Readable, Writable } from 'stream'
-import { RequestContext } from '../../../server/v2/RequestContext'
-import { LockScope } from '../../../resource/v2/lock/LockScope'
-import { LockType } from '../../../resource/v2/lock/LockType'
-import { LockKind } from '../../../resource/v2/lock/LockKind'
-import { Workflow } from '../../../helper/Workflow'
-import { Errors } from '../../../Errors'
import { Lock } from '../../../resource/v2/lock/Lock'
-import { Path } from '../Path'
-import * as mimeTypes from 'mime-types'
-import * as crypto from 'crypto'
export interface ILockManager
{
diff --git a/src/manager/v2/fileSystem/PropertyManager.ts b/src/manager/v2/fileSystem/PropertyManager.ts
index e95784ab..3f70edb3 100644
--- a/src/manager/v2/fileSystem/PropertyManager.ts
+++ b/src/manager/v2/fileSystem/PropertyManager.ts
@@ -1,15 +1,5 @@
import { ReturnCallback, Return2Callback, SimpleCallback, ResourcePropertyValue, PropertyAttributes } from './CommonTypes'
-import { Readable, Writable } from 'stream'
-import { RequestContext } from '../../../server/v2/RequestContext'
-import { LockScope } from '../../../resource/v2/lock/LockScope'
-import { LockType } from '../../../resource/v2/lock/LockType'
-import { LockKind } from '../../../resource/v2/lock/LockKind'
-import { Workflow } from '../../../helper/Workflow'
import { Errors } from '../../../Errors'
-import { Lock } from '../../../resource/v2/lock/Lock'
-import { Path } from '../Path'
-import * as mimeTypes from 'mime-types'
-import * as crypto from 'crypto'
export interface PropertyBag
{
diff --git a/src/manager/v2/fileSystem/Resource.ts b/src/manager/v2/fileSystem/Resource.ts
index 6ce60d51..41609e9e 100644
--- a/src/manager/v2/fileSystem/Resource.ts
+++ b/src/manager/v2/fileSystem/Resource.ts
@@ -1,25 +1,3 @@
-import {
- AvailableLocksInfo,
- CopyInfo,
- CreateInfo,
- CreationDateInfo,
- DeleteInfo,
- DisplayNameInfo,
- ETagInfo,
- IContextInfo,
- LastModifiedDateInfo,
- LockManagerInfo,
- MimeTypeInfo,
- MoveInfo,
- OpenReadStreamInfo,
- OpenWriteStreamInfo,
- PropertyManagerInfo,
- ReadDirInfo,
- RenameInfo,
- SizeInfo,
- TypeInfo,
- WebNameInfo
-} from './ContextInfo'
import {
ReturnCallback,
SimpleCallback,
@@ -28,21 +6,14 @@ import {
SubTree,
ResourceType
} from './CommonTypes'
-import { FileSystemSerializer, ISerializableFileSystem } from './Serialization'
import { Readable, Writable } from 'stream'
import { IPropertyManager } from './PropertyManager'
import { RequestContext } from '../../../server/v2/RequestContext'
import { ILockManager } from './LockManager'
import { FileSystem } from './FileSystem'
-import { LockScope } from '../../../resource/v2/lock/LockScope'
-import { LockType } from '../../../resource/v2/lock/LockType'
import { LockKind } from '../../../resource/v2/lock/LockKind'
-import { Workflow } from '../../../helper/Workflow'
-import { Errors } from '../../../Errors'
import { Lock } from '../../../resource/v2/lock/Lock'
import { Path } from '../Path'
-import * as mimeTypes from 'mime-types'
-import * as crypto from 'crypto'
export class Resource
{
diff --git a/src/manager/v2/fileSystem/Serialization.ts b/src/manager/v2/fileSystem/Serialization.ts
index 06ba528f..d2c34185 100644
--- a/src/manager/v2/fileSystem/Serialization.ts
+++ b/src/manager/v2/fileSystem/Serialization.ts
@@ -1,16 +1,7 @@
-import { ReturnCallback, SimpleCallback } from './CommonTypes'
import { SerializerNotFound } from '../../../Errors'
-import { Readable, Writable } from 'stream'
-import { RequestContext } from '../../../server/v2/RequestContext'
+import { ReturnCallback } from './CommonTypes'
import { FileSystem } from './FileSystem'
-import { LockScope } from '../../../resource/v2/lock/LockScope'
-import { LockType } from '../../../resource/v2/lock/LockType'
-import { LockKind } from '../../../resource/v2/lock/LockKind'
import { Workflow } from '../../../helper/Workflow'
-import { Lock } from '../../../resource/v2/lock/Lock'
-import { Path } from '../Path'
-import * as mimeTypes from 'mime-types'
-import * as crypto from 'crypto'
export interface ISerializableFileSystem
{
diff --git a/src/manager/v2/fileSystem/StandardMethods.ts b/src/manager/v2/fileSystem/StandardMethods.ts
index 512bc767..997c830a 100644
--- a/src/manager/v2/fileSystem/StandardMethods.ts
+++ b/src/manager/v2/fileSystem/StandardMethods.ts
@@ -1,16 +1,10 @@
import { ReturnCallback, SimpleCallback } from './CommonTypes'
-import { Readable, Writable } from 'stream'
import { RequestContext } from '../../../server/v2/RequestContext'
import { FileSystem } from './FileSystem'
-import { LockScope } from '../../../resource/v2/lock/LockScope'
-import { LockType } from '../../../resource/v2/lock/LockType'
-import { LockKind } from '../../../resource/v2/lock/LockKind'
import { Workflow } from '../../../helper/Workflow'
import { Errors } from '../../../Errors'
-import { Lock } from '../../../resource/v2/lock/Lock'
import { Path } from '../Path'
import * as mimeTypes from 'mime-types'
-import * as crypto from 'crypto'
export abstract class StandardMethods
{
diff --git a/src/manager/v2/fileSystem/StorageManager.ts b/src/manager/v2/fileSystem/StorageManager.ts
index ef94d34e..0aeb1c67 100644
--- a/src/manager/v2/fileSystem/StorageManager.ts
+++ b/src/manager/v2/fileSystem/StorageManager.ts
@@ -94,7 +94,7 @@ export class PerUserStorageManager implements IStorageManager
return (value as XMLElement[]).map((el) => this.evalPropValue(el)).reduce((p, n) => p + n, 0);
const xml = value as XMLElement;
- const attributesLength = Object.keys(xml.attributes).map((at) => at.length + xml.attributes[at].length).reduce((p, n) => p + n, 0);
+ const attributesLength = Object.keys(xml.attributes).map((at) => at.length + (xml.attributes[at].length as number)).reduce((p, n) => p + n, 0);
return xml.name.length + attributesLength + (xml.elements && xml.elements.length > 0 ? this.evalPropValue(xml.elements) : 0);
}
evaluateProperty(ctx : RequestContext, fs : FileSystem, name : string, value : ResourcePropertyValue, attributes : PropertyAttributes, callback : IStorageManagerEvaluateCallback) : void
diff --git a/src/manager/v2/instances/VirtualFileSystem.ts b/src/manager/v2/instances/VirtualFileSystem.ts
index 853b4e06..456baedc 100644
--- a/src/manager/v2/instances/VirtualFileSystem.ts
+++ b/src/manager/v2/instances/VirtualFileSystem.ts
@@ -18,7 +18,6 @@ import {
DeleteInfo,
FileSystem,
SizeInfo,
- MoveInfo,
TypeInfo,
} from '../fileSystem/export'
import { Readable, Writable } from 'stream'
@@ -193,7 +192,7 @@ export class VirtualFileSystem extends FileSystem
if(resource === undefined)
return callback(Errors.ResourceNotFound);
- const content = [];
+ const content : Buffer[] = [];
const stream = new VirtualFileWritable(content);
stream.on('finish', () => {
resource.content = content;
diff --git a/src/server/v2/WebDAVServerOptions.ts b/src/server/v2/WebDAVServerOptions.ts
index e30f81cd..b294c51d 100644
--- a/src/server/v2/WebDAVServerOptions.ts
+++ b/src/server/v2/WebDAVServerOptions.ts
@@ -1,13 +1,11 @@
import { IStorageManager, NoStorageManager } from '../../manager/v2/fileSystem/StorageManager'
import { HTTPDigestAuthentication } from '../../user/v2/authentication/HTTPDigestAuthentication'
-import { HTTPBasicAuthentication } from '../../user/v2/authentication/HTTPBasicAuthentication'
import { FileSystemSerializer } from '../../manager/v2/fileSystem/Serialization'
import { HTTPAuthentication } from '../../user/v2/authentication/HTTPAuthentication'
import { Writable, Readable } from 'stream'
import { VirtualFileSystem } from '../../manager/v2/instances/VirtualFileSystem'
import { SimpleUserManager } from '../../user/v2/simple/SimpleUserManager'
import { PrivilegeManager } from '../../user/v2/privilege/PrivilegeManager'
-import { IUserManager } from '../../user/v2/IUserManager'
import { FileSystem } from '../../manager/v2/fileSystem/FileSystem'
import * as https from 'https'
diff --git a/src/server/v2/commands/Copy.ts b/src/server/v2/commands/Copy.ts
index 040e9f7f..d457dc2e 100644
--- a/src/server/v2/commands/Copy.ts
+++ b/src/server/v2/commands/Copy.ts
@@ -1,9 +1,5 @@
-import { HTTPCodes, HTTPMethod, HTTPRequestContext } from '../WebDAVRequest'
-import { ResourceType, SimpleCallback } from '../../../manager/v2/fileSystem/CommonTypes'
-import { Path } from '../../../manager/v2/Path'
-import { Workflow } from '../../../helper/Workflow'
-import { Readable } from 'stream'
-import { Errors } from '../../../Errors'
+import { HTTPMethod, HTTPRequestContext } from '../WebDAVRequest'
+import { ResourceType } from '../../../manager/v2/fileSystem/CommonTypes'
import { execute } from './Move'
export default class implements HTTPMethod
diff --git a/src/server/v2/commands/Get.ts b/src/server/v2/commands/Get.ts
index 783e27f3..ff2d4748 100644
--- a/src/server/v2/commands/Get.ts
+++ b/src/server/v2/commands/Get.ts
@@ -1,41 +1,7 @@
import { HTTPCodes, HTTPRequestContext, HTTPMethod } from '../WebDAVRequest'
import { ResourceType } from '../../../manager/v2/fileSystem/CommonTypes'
-import { Errors } from '../../../Errors'
import { Transform } from 'stream'
-class MultipleRangedStream extends Transform
-{
- streams : { stream : RangedStream, range : IRange }[]
- onEnded : () => void
-
- constructor(public ranges : IRange[])
- {
- super();
-
- this.streams = ranges.map((r) => {
- return {
- stream: new RangedStream(r.min, r.max),
- range: r
- }
- });
- }
-
- _transform(chunk : string | Buffer, encoding : string, callback : Function)
- {
- this.streams.forEach((streamRange) => {
- streamRange.stream.write(chunk, encoding);
- });
-
- callback(null, new Buffer(0));
- }
-
- end(chunk ?: any, encoding?: any, cb?: Function): void
- {
- if(this.onEnded)
- process.nextTick(() => this.onEnded());
- super.end(chunk, encoding, cb);
- }
-}
class RangedStream extends Transform
{
nb : number;
@@ -77,6 +43,40 @@ class RangedStream extends Transform
}
}
+class MultipleRangedStream extends Transform
+{
+ streams : { stream : RangedStream, range : IRange }[]
+ onEnded : () => void
+
+ constructor(public ranges : IRange[])
+ {
+ super();
+
+ this.streams = ranges.map((r) => {
+ return {
+ stream: new RangedStream(r.min, r.max),
+ range: r
+ }
+ });
+ }
+
+ _transform(chunk : string | Buffer, encoding : string, callback : Function)
+ {
+ this.streams.forEach((streamRange) => {
+ streamRange.stream.write(chunk, encoding);
+ });
+
+ callback(null, new Buffer(0));
+ }
+
+ end(chunk ?: any, encoding?: any, cb?: Function): void
+ {
+ if(this.onEnded)
+ process.nextTick(() => this.onEnded());
+ super.end(chunk, encoding, cb);
+ }
+}
+
export interface IRange
{
min : number
@@ -85,16 +85,28 @@ export interface IRange
export function parseRangeHeader(mimeType : string, size : number, range : string)
{
+ const separator = Array.apply(null, { length: 20 })
+ .map(() => String.fromCharCode('a'.charCodeAt(0) + Math.floor(Math.random() * 26)))
+ .join('');
+
const createMultipart = (range : IRange) => {
- return '--' + separator + '\r\nContent-Type: ' + mimeType + '\r\nContent-Range: bytes ' + range.min + '-' + range.max + '/*\r\n\r\n';
+ return `--${separator}\r\nContent-Type: ${mimeType}\r\nContent-Range: bytes ${range.min}-${range.max}/*\r\n\r\n`;
};
const endMultipart = () => {
- return '\r\n--' + separator + '--';
+ return `\r\n--${separator}--`;
};
- const ranges = range.split(',').map((block) => parseRangeBlock(size, block));
- const separator = Array.apply(null, {length: 20}).map(() => String.fromCharCode('a'.charCodeAt(0) + Math.floor(Math.random() * 26))).join('');
- const len = ranges.reduce((previous, mm) => mm.max - mm.min + 1 + previous, 0) + (ranges.length > 1 ? ranges.reduce((previous, mm) => createMultipart(mm).length + previous, endMultipart().length + '\r\n'.length * (ranges.length - 1)) : 0);
+ const ranges = range
+ .split(',')
+ .map((block) => parseRangeBlock(size, block));
+
+ const len = ranges.reduce((previous, mm) => mm.max - mm.min + 1 + previous, 0)
+ + (ranges.length <= 1 ?
+ 0 : ranges.reduce(
+ (previous, mm) => createMultipart(mm).length + previous,
+ endMultipart().length + '\r\n'.length * (ranges.length - 1)
+ )
+ );
return {
ranges,
@@ -198,12 +210,12 @@ export default class implements HTTPMethod
if(ranges.length <= 1)
{
ctx.response.setHeader('Content-Type', mimeType)
- ctx.response.setHeader('Content-Range', 'bytes ' + ranges[0].min + '-' + ranges[0].max + '/*')
+ ctx.response.setHeader('Content-Range', `bytes ${ranges[0].min}-${ranges[0].max}/*`)
rstream.on('end', callback);
return rstream.pipe(new RangedStream(ranges[0].min, ranges[0].max)).pipe(ctx.response);
}
- ctx.response.setHeader('Content-Type', 'multipart/byteranges; boundary=' + separator)
+ ctx.response.setHeader('Content-Type', `multipart/byteranges; boundary=${separator}`)
const multi = new MultipleRangedStream(ranges);
rstream.pipe(multi);
diff --git a/src/server/v2/commands/Head.ts b/src/server/v2/commands/Head.ts
index 47924401..d118e644 100644
--- a/src/server/v2/commands/Head.ts
+++ b/src/server/v2/commands/Head.ts
@@ -1,7 +1,6 @@
import { HTTPCodes, HTTPMethod, HTTPRequestContext } from '../WebDAVRequest'
-import { ResourceType } from '../../../manager/v2/fileSystem/CommonTypes'
-import { Errors } from '../../../Errors'
import { parseRangeHeader } from './Get'
+import { ResourceType } from '../../../manager/v2/fileSystem/CommonTypes'
export default class implements HTTPMethod
{
@@ -53,10 +52,10 @@ export default class implements HTTPMethod
if(ranges.length <= 1)
{
ctx.response.setHeader('Content-Type', mimeType)
- ctx.response.setHeader('Content-Range', 'bytes ' + ranges[0].min + '-' + ranges[0].max + '/*')
+ ctx.response.setHeader('Content-Range', `bytes ${ranges[0].min}-${ranges[0].max}/*`)
}
else
- ctx.response.setHeader('Content-Type', 'multipart/byteranges; boundary=' + separator)
+ ctx.response.setHeader('Content-Type', `multipart/byteranges; boundary=${separator}`)
}
catch(ex)
{
diff --git a/src/server/v2/commands/Lock.ts b/src/server/v2/commands/Lock.ts
index e003d0a6..99919935 100644
--- a/src/server/v2/commands/Lock.ts
+++ b/src/server/v2/commands/Lock.ts
@@ -8,8 +8,6 @@ import { LockType } from '../../../resource/v2/lock/LockType'
import { Errors } from '../../../Errors'
import { Lock } from '../../../resource/v2/lock/Lock'
import { XML, XMLElementBuilder } from 'xml-js-builder'
-import { IUser } from '../../../user/v2/IUser'
-import * as path from 'path'
function createResponse(ctx : HTTPRequestContext, lock : Lock)
{
@@ -25,7 +23,7 @@ function createResponse(ctx : HTTPRequestContext, lock : Lock)
activelock.ele('D:depth').add(lock.depth === -1 ? 'infinity' : lock.depth.toString());
if(lock.owner)
activelock.ele('D:owner').add(lock.owner);
- activelock.ele('D:timeout').add('Second-' + lock.lockKind.timeout);
+ activelock.ele('D:timeout').add(`Second-${lock.lockKind.timeout}`);
return prop;
}
diff --git a/src/server/v2/commands/Mkcol.ts b/src/server/v2/commands/Mkcol.ts
index ca4b7611..f2635040 100644
--- a/src/server/v2/commands/Mkcol.ts
+++ b/src/server/v2/commands/Mkcol.ts
@@ -1,8 +1,6 @@
import { HTTPCodes, HTTPMethod, HTTPRequestContext } from '../WebDAVRequest'
import { ResourceType } from '../../../manager/v2/fileSystem/CommonTypes'
-import { Path } from '../../../manager/v2/Path'
import { Errors } from '../../../Errors'
-import * as path from 'path'
export default class implements HTTPMethod
{
diff --git a/src/server/v2/commands/Move.ts b/src/server/v2/commands/Move.ts
index a2c5fe39..dff4abd0 100644
--- a/src/server/v2/commands/Move.ts
+++ b/src/server/v2/commands/Move.ts
@@ -18,7 +18,7 @@ export function execute(ctx : HTTPRequestContext, methodName : string, privilege
return callback();
}
- const startIndex = destination.indexOf('://');
+ const startIndex : number = destination.indexOf('://');
if(startIndex !== -1)
{
destination = destination.substring(startIndex + '://'.length)
diff --git a/src/server/v2/commands/Propfind.ts b/src/server/v2/commands/Propfind.ts
index e6999e1b..b4eca315 100644
--- a/src/server/v2/commands/Propfind.ts
+++ b/src/server/v2/commands/Propfind.ts
@@ -1,9 +1,8 @@
import { HTTPCodes, HTTPRequestContext, HTTPMethod } from '../WebDAVRequest'
import { XML, XMLElementBuilder, XMLElement } from 'xml-js-builder'
-import { Workflow } from '../../../helper/Workflow'
import { ResourceType } from '../../../manager/v2/fileSystem/CommonTypes'
+import { Workflow } from '../../../helper/Workflow'
import { Resource } from '../../../manager/v2/fileSystem/Resource'
-import { Path } from '../../../manager/v2/Path'
import { Errors } from '../../../Errors'
import { Lock } from '../../../resource/v2/lock/Lock'
import * as http from 'http'
@@ -90,7 +89,7 @@ function parseRequestBody(ctx : HTTPRequestContext, data : Buffer) : PropertyRul
function propstatStatus(status : number)
{
- return 'HTTP/1.1 ' + status + ' ' + http.STATUS_CODES[status];
+ return `HTTP/1.1 ${status} ${http.STATUS_CODES[status]}`;
}
export default class implements HTTPMethod
@@ -111,7 +110,7 @@ export default class implements HTTPMethod
if(errorNumber !== null)
{
const response = new XMLElementBuilder('D:response');
- response.ele('D:propstat').ele('D:status').add('HTTP/1.1 ' + errorNumber + ' ' + http.STATUS_CODES[errorNumber]);
+ response.ele('D:propstat').ele('D:status').add(`HTTP/1.1 ${errorNumber} ${http.STATUS_CODES[errorNumber]}`);
resource.fs.getFullPath(ctx, resource.path, (e, path) => {
if(e)
return nbOut(e);
@@ -219,7 +218,7 @@ export default class implements HTTPMethod
activelock.ele('D:depth').add('Infinity')
if(lock.owner)
activelock.ele('D:owner').add(lock.owner)
- activelock.ele('D:timeout').add('Second-' + (lock.expirationDate - Date.now()))
+ activelock.ele('D:timeout').add(`Second-${lock.expirationDate - Date.now()}`)
activelock.ele('D:locktoken').ele('D:href', undefined, true).add(lock.uuid)
activelock.ele('D:lockroot').ele('D:href', undefined, true).add(HTTPRequestContext.encodeURL(ctx.fullUri(path)))
}
@@ -368,8 +367,6 @@ export default class implements HTTPMethod
unchunked(ctx : HTTPRequestContext, data : Buffer, callback : () => void) : void
{
ctx.getResource((e, resource) => {
- const lockDiscoveryCache = {};
-
ctx.checkIfHeader(resource, () => {
const multistatus = new XMLElementBuilder('D:multistatus', {
'xmlns:D': 'DAV:'
diff --git a/src/server/v2/commands/Proppatch.ts b/src/server/v2/commands/Proppatch.ts
index 85f129cb..a67953e6 100644
--- a/src/server/v2/commands/Proppatch.ts
+++ b/src/server/v2/commands/Proppatch.ts
@@ -1,9 +1,8 @@
import { HTTPCodes, HTTPMethod, HTTPRequestContext } from '../WebDAVRequest'
+import { XML, XMLElementBuilder, XMLElement } from 'xml-js-builder'
import { ResourceType } from '../../../manager/v2/fileSystem/CommonTypes'
-import { IPropertyManager } from '../../../manager/v2/fileSystem/PropertyManager'
import { STATUS_CODES } from 'http'
import { Workflow } from '../../../helper/Workflow'
-import { XML, XMLElementBuilder, XMLElement } from 'xml-js-builder'
import { Errors } from '../../../Errors'
export default class implements HTTPMethod
diff --git a/src/server/v2/commands/Put.ts b/src/server/v2/commands/Put.ts
index 545f0231..aa63e9fb 100644
--- a/src/server/v2/commands/Put.ts
+++ b/src/server/v2/commands/Put.ts
@@ -1,8 +1,7 @@
import { HTTPCodes, HTTPMethod, HTTPRequestContext } from '../WebDAVRequest'
import { ResourceType, OpenWriteStreamMode } from '../../../manager/v2/fileSystem/CommonTypes'
-import { Errors } from '../../../Errors'
import { Readable } from 'stream'
-import * as path from 'path'
+import { Errors } from '../../../Errors'
export default class implements HTTPMethod
{
diff --git a/src/server/v2/commands/Unlock.ts b/src/server/v2/commands/Unlock.ts
index 8a333eff..c4c11e04 100644
--- a/src/server/v2/commands/Unlock.ts
+++ b/src/server/v2/commands/Unlock.ts
@@ -1,12 +1,5 @@
import { HTTPCodes, HTTPMethod, HTTPRequestContext } from '../WebDAVRequest'
import { ResourceType } from '../../../manager/v2/fileSystem/CommonTypes'
-import { STATUS_CODES } from 'http'
-import { LockScope } from '../../../resource/v2/lock/LockScope'
-import { LockKind } from '../../../resource/v2/lock/LockKind'
-import { LockType } from '../../../resource/v2/lock/LockType'
-import { Errors } from '../../../Errors'
-import { Lock } from '../../../resource/v2/lock/Lock'
-import { XML } from 'xml-js-builder'
export default class implements HTTPMethod
{
diff --git a/src/server/v2/webDAVServer/BeforeAfter.ts b/src/server/v2/webDAVServer/BeforeAfter.ts
index 16ac9ed6..44e46169 100644
--- a/src/server/v2/webDAVServer/BeforeAfter.ts
+++ b/src/server/v2/webDAVServer/BeforeAfter.ts
@@ -1,4 +1,4 @@
-import { HTTPRequestContext, HTTPMethod } from '../WebDAVRequest'
+import { HTTPRequestContext } from '../WebDAVRequest'
export type RequestListener = (ctx : HTTPRequestContext, next : () => void) => void;
diff --git a/src/server/v2/webDAVServer/Persistence.ts b/src/server/v2/webDAVServer/Persistence.ts
index 72f09371..14b97bea 100644
--- a/src/server/v2/webDAVServer/Persistence.ts
+++ b/src/server/v2/webDAVServer/Persistence.ts
@@ -1,10 +1,9 @@
-import { FileSystem } from '../../../manager/v2/fileSystem/FileSystem'
-import { SimpleCallback } from '../../../manager/v2/fileSystem/CommonTypes'
import { FileSystemSerializer, serialize, unserialize, SerializedData } from '../../../manager/v2/fileSystem/Serialization'
-import { VirtualSerializerVersions } from '../../../manager/v2/instances/VirtualFileSystem'
import { PhysicalSerializerVersions } from '../../../manager/v2/instances/PhysicalFileSystem'
-import { HTTPRequestContext } from '../RequestContext'
+import { VirtualSerializerVersions } from '../../../manager/v2/instances/VirtualFileSystem'
import { IAutoSave, IAutoLoad } from '../WebDAVServerOptions'
+import { HTTPRequestContext } from '../RequestContext'
+import { SimpleCallback } from '../../../manager/v2/fileSystem/CommonTypes'
import { Readable } from 'stream'
import * as zlib from 'zlib'
import * as fs from 'fs'
diff --git a/src/server/v2/webDAVServer/StartStop.ts b/src/server/v2/webDAVServer/StartStop.ts
index f7cc8962..ee242cac 100644
--- a/src/server/v2/webDAVServer/StartStop.ts
+++ b/src/server/v2/webDAVServer/StartStop.ts
@@ -1,14 +1,8 @@
import { HTTPCodes, HTTPRequestContext, HTTPMethod } from '../WebDAVRequest'
import { WebDAVServerStartCallback } from './WebDAVServer'
-import { Writable, Readable } from 'stream'
import { Errors } from '../../../Errors'
-import { WebDAVServer } from './WebDAVServer'
-import { autoSave } from './Persistence'
-import { IAutoSave } from '../WebDAVServerOptions'
import * as https from 'https'
import * as http from 'http'
-import * as zlib from 'zlib'
-import * as fs from 'fs'
export function executeRequest(req : http.IncomingMessage, res : http.ServerResponse, rootPath ?: string) : void
{
diff --git a/src/server/v2/webDAVServer/WebDAVServer.ts b/src/server/v2/webDAVServer/WebDAVServer.ts
index cba444db..816d67fc 100644
--- a/src/server/v2/webDAVServer/WebDAVServer.ts
+++ b/src/server/v2/webDAVServer/WebDAVServer.ts
@@ -1,12 +1,11 @@
-import { HTTPRequestContext, ExternalRequestContext, RequestContextExternalOptions, RequestContext } from '../RequestContext'
+import { ExternalRequestContext, RequestContextExternalOptions, RequestContext } from '../RequestContext'
import { WebDAVServerOptions, setDefaultServerOptions, IAutoSave } from '../WebDAVServerOptions'
-import { HTTPCodes, HTTPMethod } from '../WebDAVRequest'
import { HTTPAuthentication } from '../../../user/v2/authentication/HTTPAuthentication'
import { PrivilegeManager } from '../../../user/v2/privilege/PrivilegeManager'
-import { FileSystem } from '../../../manager/v2/fileSystem/FileSystem'
import { ReturnCallback } from '../../../manager/v2/fileSystem/CommonTypes'
+import { HTTPMethod } from '../WebDAVRequest'
+import { FileSystem } from '../../../manager/v2/fileSystem/FileSystem'
import { Resource } from '../../../manager/v2/fileSystem/Resource'
-import { Readable } from 'stream'
import Commands from '../commands/Commands'
import { Path } from '../../../manager/v2/Path'
diff --git a/src/user/v2/authentication/HTTPAuthentication.ts b/src/user/v2/authentication/HTTPAuthentication.ts
index 9990c136..a6539561 100644
--- a/src/user/v2/authentication/HTTPAuthentication.ts
+++ b/src/user/v2/authentication/HTTPAuthentication.ts
@@ -1,5 +1,4 @@
import { HTTPRequestContext } from '../../../server/v2/RequestContext'
-import { IUserManager } from '../IUserManager'
import { IUser } from '../IUser'
export interface HTTPAuthentication
diff --git a/src/user/v2/authentication/HTTPDigestAuthentication.ts b/src/user/v2/authentication/HTTPDigestAuthentication.ts
index bed74595..bf902091 100644
--- a/src/user/v2/authentication/HTTPDigestAuthentication.ts
+++ b/src/user/v2/authentication/HTTPDigestAuthentication.ts
@@ -27,7 +27,7 @@ export class HTTPDigestAuthentication implements HTTPAuthentication
askForAuthentication()
{
return {
- 'WWW-Authenticate': 'Digest realm="' + this.realm + '", qop="auth", nonce="' + this.generateNonce() + '", opaque="' + this.generateNonce() + '"'
+ 'WWW-Authenticate': `Digest realm="${this.realm}", qop="auth", nonce="${this.generateNonce()}", opaque="${this.generateNonce()}"`
}
}
@@ -67,21 +67,21 @@ export class HTTPDigestAuthentication implements HTTPAuthentication
if(e)
return onError(e);
- let ha1 = md5(authProps.username + ':' + this.realm + ':' + (user.password ? user.password : ''));
+ let ha1 = md5(`${authProps.username}:${this.realm}:${user.password ? user.password : ''}`);
if(authProps.algorithm === 'MD5-sess')
- ha1 = md5(ha1 + ':' + authProps.nonce + ':' + authProps.cnonce);
+ ha1 = md5(`${ha1}:${authProps.nonce}:${authProps.cnonce}`);
let ha2;
if(authProps.qop === 'auth-int')
return onError(Errors.WrongHeaderFormat); // ha2 = md5(ctx.request.method.toString().toUpperCase() + ':' + ctx.requested.uri + ':' + md5(...));
else
- ha2 = md5(ctx.request.method.toString().toUpperCase() + ':' + ctx.requested.uri);
+ ha2 = md5(`${ctx.request.method.toString().toUpperCase()}:${ctx.requested.uri}`);
let result;
if(authProps.qop === 'auth-int' || authProps.qop === 'auth')
- result = md5(ha1 + ':' + authProps.nonce + ':' + authProps.nc + ':' + authProps.cnonce + ':' + authProps.qop + ':' + ha2);
+ result = md5(`${ha1}:${authProps.nonce}:${authProps.nc}:${authProps.cnonce}:${authProps.qop}:${ha2}`);
else
- result = md5(ha1 + ':' + authProps.nonce + ':' + ha2);
+ result = md5(`${ha1}:${authProps.nonce}:${ha2}`);
if(result.toLowerCase() === authProps.response.toLowerCase())
callback(Errors.None, user);