FileMediaBackend: Fix generated urls

All urls should be of the form `uploads/<filename>.<extension>` regardless of what the uploadDirectory is, because the backend proxies all locally uploaded files.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-03-31 23:01:29 +02:00
parent c821fe6f04
commit 4fb7623225

View file

@ -36,7 +36,7 @@ export class FilesystemBackend implements MediaBackend {
await this.ensureDirectory();
try {
await fs.writeFile(filePath, buffer, null);
return ['/' + filePath, null];
return ['/uploads/' + fileName, null];
} catch (e) {
this.logger.error((e as Error).message, (e as Error).stack, 'saveFile');
throw new MediaBackendError(`Could not save '${filePath}'`);