mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-21 10:45:20 -04:00
MediaService: Simplify saveFile
signature
As the `saveFile` method only really uses the files `Buffer`, this commit changes the signature so it directly gets a `Buffer` instead of a complicated `MulterFile` object. This also simplifies testing. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
53fbe82b6a
commit
2b23dcc5a9
2 changed files with 9 additions and 8 deletions
|
@ -19,14 +19,12 @@ import {
|
|||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import { MediaService } from '../../../media/media.service';
|
||||
import { MulterFile } from '../../../media/multer-file.interface';
|
||||
import { NotesService } from '../../../notes/notes.service';
|
||||
|
||||
@Controller('media')
|
||||
export class MediaController {
|
||||
constructor(
|
||||
private readonly logger: ConsoleLoggerService,
|
||||
private mediaService: MediaService,
|
||||
private notesService: NotesService,
|
||||
) {
|
||||
this.logger.setContext(MediaController.name);
|
||||
}
|
||||
|
@ -44,7 +42,11 @@ export class MediaController {
|
|||
'uploadImage',
|
||||
);
|
||||
try {
|
||||
const url = await this.mediaService.saveFile(file, username, noteId);
|
||||
const url = await this.mediaService.saveFile(
|
||||
file.buffer,
|
||||
username,
|
||||
noteId,
|
||||
);
|
||||
return {
|
||||
link: url,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue