Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
refactor(backend:webdav): remove `httpVersion` from context and replace with constant `HTTP_VERSION` usage
johaven2e648ae93db9
diff --git a/backend/src/applications/webdav/guards/webdav-protocol.guard.ts b/backend/src/applications/webdav/guards/webdav-protocol.guard.tsindex a5c33e52..5ee0b56c 100644--- a/backend/src/applications/webdav/guards/webdav-protocol.guard.ts+++ b/backend/src/applications/webdav/guards/webdav-protocol.guard.ts@@ -3,7 +3,7 @@ import { ValidationError } from 'fast-xml-parser'import { FastifyReply } from 'fastify'import { urlToPath } from '../../../common/functions'import { decodeUrl } from '../../../common/shared'-import { HTTP_METHOD, HTTP_VERSION } from '../../applications.constants'+import { HTTP_METHOD } from '../../applications.constants'import { CACHE_LOCK_DEFAULT_TTL } from '../../files/constants/cache'import { USER_PERMISSION } from '../../users/constants/user'import {@@ -88,7 +88,6 @@ export class WebDAVProtocolGuard implements CanActivate {} else {throw new HttpException(`${valid.err.code} : ${valid.err.msg}`, HttpStatus.BAD_REQUEST)}- req.dav.httpVersion = HTTP_VERSIONreq.dav.body = bodyreturn true}diff --git a/backend/src/applications/webdav/interfaces/webdav.interface.ts b/backend/src/applications/webdav/interfaces/webdav.interface.tsindex c2f84a9c..7d24f674 100644--- a/backend/src/applications/webdav/interfaces/webdav.interface.ts+++ b/backend/src/applications/webdav/interfaces/webdav.interface.ts@@ -6,7 +6,6 @@ import { IfHeader } from './if-header.interface'export interface WebDAVContext {url: stringbody?: any // xml content- httpVersion?: stringifHeaders?: IfHeader[]depth?: DEPTH | stringpropfindMode?: PROPSTATdiff --git a/backend/src/applications/webdav/services/webdav-methods.service.ts b/backend/src/applications/webdav/services/webdav-methods.service.tsindex dd976c63..2856d142 100644--- a/backend/src/applications/webdav/services/webdav-methods.service.ts+++ b/backend/src/applications/webdav/services/webdav-methods.service.ts@@ -1,6 +1,7 @@import { HttpException, HttpStatus, Injectable, Logger, StreamableFile } from '@nestjs/common'import { FastifyReply } from 'fastify'import { currentTimeStamp, encodeUrl } from '../../../common/shared'+import { HTTP_VERSION } from '../../applications.constants'import { FileLock, FileLockOptions } from '../../files/interfaces/file-lock.interface'import { FileError } from '../../files/models/file-error'import { LockConflict } from '../../files/models/file-lock-error'@@ -203,7 +204,7 @@ export class WebDAVMethods {if (fP !== undefined) prop[`${NS_PREFIX}:${p}`] = fP}}- responses.push(PROP_STAT(f.href, PROP(prop, req.dav.httpVersion, HttpStatus.OK)))+ responses.push(PROP_STAT(f.href, PROP(prop, HTTP_VERSION, HttpStatus.OK)))}const propfind = xmlBuild(MULTI_STATUS(responses))return res.type(XML_CONTENT_TYPE).status(HttpStatus.MULTI_STATUS).send(propfind)@@ -292,7 +293,7 @@ export class WebDAVMethods {req.dav.proppatch.errors.push(PROP({ [`${NS_PREFIX}:${name}`]: null },- req.dav.httpVersion,+ HTTP_VERSION,HttpStatus.FORBIDDEN,STANDARD_PROPS.indexOf(name) > -1 ? PRECONDITION.PROTECTED_PROPERTY : undefined)@@ -307,7 +308,7 @@ export class WebDAVMethods {if (req.dav.proppatch.errors.length) {// convert all passed props to failed dependencyfor (const name of Object.keys(req.dav.proppatch.props)) {- req.dav.proppatch.errors.push(PROP({ [`${NS_PREFIX}:${name}`]: null }, req.dav.httpVersion, HttpStatus.FAILED_DEPENDENCY))+ req.dav.proppatch.errors.push(PROP({ [`${NS_PREFIX}:${name}`]: null }, HTTP_VERSION, HttpStatus.FAILED_DEPENDENCY))}const proppatch = xmlBuild(MULTI_STATUS(PROP_STAT(encodeUrl(req.dav.url), req.dav.proppatch.errors)))return res.status(HttpStatus.MULTI_STATUS).type(XML_CONTENT_TYPE).send(proppatch)@@ -335,7 +336,7 @@ export class WebDAVMethods {props.push(PROP({ [`${NS_PREFIX}:${name}`]: null },- req.dav.httpVersion,+ HTTP_VERSION,state ? (atLeastOneError ? HttpStatus.FAILED_DEPENDENCY : HttpStatus.OK) : HttpStatus.BAD_REQUEST))