Linting: Fixed wrong logger contexts

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-05-02 21:53:28 +02:00
parent 07a4de77d7
commit b07c3be398
5 changed files with 7 additions and 7 deletions

View file

@ -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(

View file

@ -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}'`,

View file

@ -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) {

View file

@ -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');

View file

@ -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');