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/*
!public/uploads/.gitkeep !public/uploads/.gitkeep
uploads uploads
test_uploads

View file

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

View file

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