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'; const username = 'hardcoded';
this.logger.debug( this.logger.debug(
`Recieved filename '${file.originalname}' for note '${noteId}' from user '${username}'`, `Recieved filename '${file.originalname}' for note '${noteId}' from user '${username}'`,
'uploadImage', 'uploadMedia',
); );
try { try {
const url = await this.mediaService.saveFile( const url = await this.mediaService.saveFile(

View file

@ -101,7 +101,7 @@ export class MediaController {
const username = req.user.userName; const username = req.user.userName;
this.logger.debug( this.logger.debug(
`Recieved filename '${file.originalname}' for note '${noteId}' from user '${username}'`, `Recieved filename '${file.originalname}' for note '${noteId}' from user '${username}'`,
'uploadImage', 'uploadMedia',
); );
try { try {
const url = await this.mediaService.saveFile( const url = await this.mediaService.saveFile(
@ -142,7 +142,7 @@ export class MediaController {
try { try {
this.logger.debug( this.logger.debug(
`Deleting '${filename}' for user '${username}'`, `Deleting '${filename}' for user '${username}'`,
'deleteFile', 'deleteMedia',
); );
const mediaUpload = await this.mediaService.findUploadByFilename( const mediaUpload = await this.mediaService.findUploadByFilename(
filename, filename,
@ -150,7 +150,7 @@ export class MediaController {
if (mediaUpload.user.userName !== username) { if (mediaUpload.user.userName !== username) {
this.logger.warn( this.logger.warn(
`${username} tried to delete '${filename}', but is not the owner`, `${username} tried to delete '${filename}', but is not the owner`,
'deleteFile', 'deleteMedia',
); );
throw new PermissionError( throw new PermissionError(
`File '${filename}' is not owned by '${username}'`, `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}` }, headers: { Authorization: `Client-ID ${this.config.clientID}` },
}, },
).then((res) => ImgurBackend.checkStatus(res)); ).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'); this.logger.log(`Deleted ${fileName}`, 'deleteFile');
return; return;
} catch (e) { } catch (e) {

View file

@ -62,7 +62,7 @@ export class S3Backend implements MediaBackend {
try { try {
await this.client.removeObject(this.config.bucket, fileName); await this.client.removeObject(this.config.bucket, fileName);
const url = this.getUrl(fileName); const url = this.getUrl(fileName);
this.logger.log(`Deleted ${url}`, 'saveFile'); this.logger.log(`Deleted ${url}`, 'deleteFile');
return; return;
} catch (e) { } catch (e) {
this.logger.error((e as Error).message, (e as Error).stack, 'saveFile'); 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)); }).then((res) => WebdavBackend.checkStatus(res));
const url = this.getUrl(fileName); const url = this.getUrl(fileName);
this.logger.log(`Deleted ${url}`, 'saveFile'); this.logger.log(`Deleted ${url}`, 'deleteFile');
return; return;
} catch (e) { } catch (e) {
this.logger.error((e as Error).message, (e as Error).stack, 'saveFile'); this.logger.error((e as Error).message, (e as Error).stack, 'saveFile');