Merge pull request #1093 from hedgedoc/config/changeMockUploadPath

This commit is contained in:
David Mehren 2021-04-06 16:59:21 +02:00 committed by GitHub
commit edb184f3a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

1
.gitignore vendored
View file

@ -41,3 +41,4 @@ dist
public/uploads/*
!public/uploads/.gitkeep
uploads
test_uploads

View file

@ -10,7 +10,7 @@ export default registerAs('mediaConfig', () => ({
backend: {
use: 'filesystem',
filesystem: {
uploadPath: 'uploads',
uploadPath: 'test_uploads',
},
},
}));

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