mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-13 00:02:30 +10:00
fix types
This commit is contained in:
@ -23,7 +23,7 @@ export class CollabWsAdapter {
|
|||||||
socket.destroy();
|
socket.destroy();
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
socket.end('HTTP/1.1 400\r\n' + err.message);
|
socket.end('HTTP/1.1 400\r\n' + (err as Error).message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ export const tiptapExtensions = [
|
|||||||
TrailingNode,
|
TrailingNode,
|
||||||
TextStyle,
|
TextStyle,
|
||||||
Color,
|
Color,
|
||||||
];
|
] as any;
|
||||||
|
|
||||||
export function jsonToHtml(tiptapJson: JSONContent) {
|
export function jsonToHtml(tiptapJson: JSONContent) {
|
||||||
return generateHTML(tiptapJson, tiptapExtensions);
|
return generateHTML(tiptapJson, tiptapExtensions);
|
||||||
|
|||||||
@ -77,7 +77,7 @@ export class AttachmentService {
|
|||||||
return attachment;
|
return attachment;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
throw new BadRequestException(err.message);
|
throw new BadRequestException('Failed to upload file');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ export class AttachmentService {
|
|||||||
return attachment;
|
return attachment;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
throw new BadRequestException(err.message);
|
throw new BadRequestException('Failed to upload file');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ export class AttachmentService {
|
|||||||
return attachment;
|
return attachment;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
throw new BadRequestException(err.message);
|
throw new BadRequestException('Failed to upload file');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,24 +20,24 @@ export class LocalDriver implements StorageDriver {
|
|||||||
async upload(filePath: string, file: Buffer): Promise<void> {
|
async upload(filePath: string, file: Buffer): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await fs.outputFile(this._fullPath(filePath), file);
|
await fs.outputFile(this._fullPath(filePath), file);
|
||||||
} catch (error) {
|
} catch (err) {
|
||||||
throw new Error(`Failed to upload file: ${error.message}`);
|
throw new Error(`Failed to upload file: ${(err as Error).message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async read(filePath: string): Promise<Buffer> {
|
async read(filePath: string): Promise<Buffer> {
|
||||||
try {
|
try {
|
||||||
return await fs.readFile(this._fullPath(filePath));
|
return await fs.readFile(this._fullPath(filePath));
|
||||||
} catch (error) {
|
} catch (err) {
|
||||||
throw new Error(`Failed to read file: ${error.message}`);
|
throw new Error(`Failed to read file: ${(err as Error).message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async exists(filePath: string): Promise<boolean> {
|
async exists(filePath: string): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
return await fs.pathExists(this._fullPath(filePath));
|
return await fs.pathExists(this._fullPath(filePath));
|
||||||
} catch (error) {
|
} catch (err) {
|
||||||
throw new Error(`Failed to check file existence: ${error.message}`);
|
throw new Error(`Failed to check file existence: ${(err as Error).message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,8 +52,8 @@ export class LocalDriver implements StorageDriver {
|
|||||||
async delete(filePath: string): Promise<void> {
|
async delete(filePath: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await fs.remove(this._fullPath(filePath));
|
await fs.remove(this._fullPath(filePath));
|
||||||
} catch (error) {
|
} catch (err) {
|
||||||
throw new Error(`Failed to delete file: ${error.message}`);
|
throw new Error(`Failed to delete file: ${(err as Error).message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -38,8 +38,8 @@ export class S3Driver implements StorageDriver {
|
|||||||
// we can get the path from location
|
// we can get the path from location
|
||||||
|
|
||||||
console.log(`File uploaded successfully: ${filePath}`);
|
console.log(`File uploaded successfully: ${filePath}`);
|
||||||
} catch (error) {
|
} catch (err) {
|
||||||
throw new Error(`Failed to upload file: ${error.message}`);
|
throw new Error(`Failed to upload file: ${(err as Error).message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,8 +53,8 @@ export class S3Driver implements StorageDriver {
|
|||||||
const response = await this.s3Client.send(command);
|
const response = await this.s3Client.send(command);
|
||||||
|
|
||||||
return streamToBuffer(response.Body as Readable);
|
return streamToBuffer(response.Body as Readable);
|
||||||
} catch (error) {
|
} catch (err) {
|
||||||
throw new Error(`Failed to read file from S3: ${error.message}`);
|
throw new Error(`Failed to read file from S3: ${(err as Error).message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ export class S3Driver implements StorageDriver {
|
|||||||
await this.s3Client.send(command);
|
await this.s3Client.send(command);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Error deleting file ${filePath} from S3. ${err.message}`,
|
`Error deleting file ${filePath} from S3. ${(err as Error).message}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user