@sync-in/server
Version:
The secure, open-source platform for file storage, sharing, collaboration, and sync
74 lines (73 loc) • 2.34 kB
JavaScript
/*
* Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>
* This file is part of Sync-in | The open source file sync and share solution
* See the LICENSE file for licensing details
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "WebDAVFile", {
enumerable: true,
get: function() {
return WebDAVFile;
}
});
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
const _shared = require("../../../common/shared");
const _files = require("../../files/constants/files");
const _files1 = require("../../files/utils/files");
const _webdav = require("../utils/webdav");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
let WebDAVFile = class WebDAVFile {
get aliasName() {
return this.alias || this.name;
}
get displayname() {
return this.name;
}
get creationdate() {
// uses RFC3339 format (ISO 8601)
return new Date(this.ctime).toISOString();
}
get getlastmodified() {
// uses RFC1123 format
return new Date(this.mtime).toUTCString();
}
get getcontentlength() {
return this.isDir ? undefined : this.size;
}
get getcontenttype() {
if (this.isDir) {
return undefined;
} else if (this.mime) {
return this.mime.replaceAll('-', '/');
}
return _files.DEFAULT_MIME_TYPE;
}
get resourcetype() {
return this.isDir ? _webdav.PROPFIND_COLLECTION : null;
}
get getetag() {
return this.isDir ? undefined : (0, _files1.genEtag)(this);
}
get supportedlock() {
return _webdav.SUPPORTED_LOCKS;
}
// eslint-disable-next-line @typescript-eslint/class-literal-property-style
get lockdiscovery() {
// implemented in propfind method, used for propname case
return null;
}
constructor(props, currentUrl, isCurrent = false){
Object.assign(this, props);
if (props?.root?.alias) {
this.alias = props.root.alias;
}
this.href = (0, _shared.encodeUrl)(_nodepath.default.join(currentUrl, isCurrent ? '' : this.aliasName, this.isDir ? '/' : ''));
}
};
//# sourceMappingURL=webdav-file.model.js.map