fix(media): use correct MediaBackendType from commons package

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson 2025-05-29 20:35:49 +00:00
parent d73dc14c5c
commit f47915dbb3
No known key found for this signature in database
GPG key ID: DB99ADDDC5C0AF82
3 changed files with 4 additions and 9 deletions

View file

@ -1,5 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -3,6 +3,7 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { MediaBackendType } from '@hedgedoc/commons';
import { Inject, Injectable } from '@nestjs/common';
import { FileTypeResult } from 'file-type';
import { promises as fs } from 'fs';
@ -12,7 +13,6 @@ import mediaConfiguration, { MediaConfig } from '../../config/media.config';
import { MediaBackendError } from '../../errors/errors';
import { ConsoleLoggerService } from '../../logger/console-logger.service';
import { MediaBackend } from '../media-backend.interface';
import { BackendType } from './backend-type.enum';
@Injectable()
export class FilesystemBackend implements MediaBackend {
@ -25,7 +25,7 @@ export class FilesystemBackend implements MediaBackend {
) {
this.logger.setContext(FilesystemBackend.name);
// only create the backend if local filesystem is configured
if (this.mediaConfig.backend.use !== BackendType.FILESYSTEM) {
if (this.mediaConfig.backend.use !== MediaBackendType.FILESYSTEM) {
this.uploadDirectory = '';
return;
}

View file

@ -3,6 +3,7 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { MediaBackendType } from '@hedgedoc/commons';
import { Inject, Injectable } from '@nestjs/common';
import fetch, { Response } from 'node-fetch';
import { URLSearchParams } from 'url';
@ -14,7 +15,6 @@ import mediaConfiguration, {
import { MediaBackendError } from '../../errors/errors';
import { ConsoleLoggerService } from '../../logger/console-logger.service';
import { MediaBackend } from '../media-backend.interface';
import { BackendType } from './backend-type.enum';
type UploadResult = {
data: {
@ -39,7 +39,7 @@ export class ImgurBackend implements MediaBackend {
) {
this.logger.setContext(ImgurBackend.name);
// only create the backend if imgur is configured
if (this.mediaConfig.backend.use !== BackendType.IMGUR) {
if (this.mediaConfig.backend.use !== MediaBackendType.IMGUR) {
return;
}
this.config = this.mediaConfig.backend.imgur;