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 committed by David Mehren
parent 6c1f72f93b
commit 1df74df65c
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

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}'`);