From f5039791ed4c0b3b3a305fcf1411e9eb324d3504 Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Sun, 2 May 2021 21:53:28 +0200 Subject: [PATCH] Linting: Fixed wrong logger contexts Signed-off-by: Philip Molares --- src/api/private/media/media.controller.ts | 2 +- src/api/public/media/media.controller.ts | 6 +++--- src/media/backends/imgur-backend.ts | 2 +- src/media/backends/s3-backend.ts | 2 +- src/media/backends/webdav-backend.ts | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/api/private/media/media.controller.ts b/src/api/private/media/media.controller.ts index 7b5fde80a..dada879ad 100644 --- a/src/api/private/media/media.controller.ts +++ b/src/api/private/media/media.controller.ts @@ -45,7 +45,7 @@ export class MediaController { const username = 'hardcoded'; this.logger.debug( `Recieved filename '${file.originalname}' for note '${noteId}' from user '${username}'`, - 'uploadImage', + 'uploadMedia', ); try { const url = await this.mediaService.saveFile( diff --git a/src/api/public/media/media.controller.ts b/src/api/public/media/media.controller.ts index 3436a1dcc..c53c3185d 100644 --- a/src/api/public/media/media.controller.ts +++ b/src/api/public/media/media.controller.ts @@ -101,7 +101,7 @@ export class MediaController { const username = req.user.userName; this.logger.debug( `Recieved filename '${file.originalname}' for note '${noteId}' from user '${username}'`, - 'uploadImage', + 'uploadMedia', ); try { const url = await this.mediaService.saveFile( @@ -142,7 +142,7 @@ export class MediaController { try { this.logger.debug( `Deleting '${filename}' for user '${username}'`, - 'deleteFile', + 'deleteMedia', ); const mediaUpload = await this.mediaService.findUploadByFilename( filename, @@ -150,7 +150,7 @@ export class MediaController { if (mediaUpload.user.userName !== username) { this.logger.warn( `${username} tried to delete '${filename}', but is not the owner`, - 'deleteFile', + 'deleteMedia', ); throw new PermissionError( `File '${filename}' is not owned by '${username}'`, diff --git a/src/media/backends/imgur-backend.ts b/src/media/backends/imgur-backend.ts index ecced7586..975cbb1b4 100644 --- a/src/media/backends/imgur-backend.ts +++ b/src/media/backends/imgur-backend.ts @@ -78,7 +78,7 @@ export class ImgurBackend implements MediaBackend { headers: { Authorization: `Client-ID ${this.config.clientID}` }, }, ).then((res) => ImgurBackend.checkStatus(res)); - this.logger.debug(`Response: ${result.toString()}`, 'saveFile'); + this.logger.debug(`Response: ${result.toString()}`, 'deleteFile'); this.logger.log(`Deleted ${fileName}`, 'deleteFile'); return; } catch (e) { diff --git a/src/media/backends/s3-backend.ts b/src/media/backends/s3-backend.ts index df048d7d8..bf1059448 100644 --- a/src/media/backends/s3-backend.ts +++ b/src/media/backends/s3-backend.ts @@ -62,7 +62,7 @@ export class S3Backend implements MediaBackend { try { await this.client.removeObject(this.config.bucket, fileName); const url = this.getUrl(fileName); - this.logger.log(`Deleted ${url}`, 'saveFile'); + this.logger.log(`Deleted ${url}`, 'deleteFile'); return; } catch (e) { this.logger.error((e as Error).message, (e as Error).stack, 'saveFile'); diff --git a/src/media/backends/webdav-backend.ts b/src/media/backends/webdav-backend.ts index 5ac985201..918d339ad 100644 --- a/src/media/backends/webdav-backend.ts +++ b/src/media/backends/webdav-backend.ts @@ -95,7 +95,7 @@ export class WebdavBackend implements MediaBackend { }, }).then((res) => WebdavBackend.checkStatus(res)); const url = this.getUrl(fileName); - this.logger.log(`Deleted ${url}`, 'saveFile'); + this.logger.log(`Deleted ${url}`, 'deleteFile'); return; } catch (e) { this.logger.error((e as Error).message, (e as Error).stack, 'saveFile');