mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-12 22:26:08 -04:00
refactor(media): add media redirection endpoint
Previous versions of HedgeDoc suffered from the problem that changing the media backend required manipulation of the media links in all created notes. We discussed in #3704 that it's favourable to have an endpoint that redirects to the image's original URL. When changing the media backend, the link stays the same but just the redirect changes. Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
1f19a6fac4
commit
8693edbf6a
16 changed files with 104 additions and 87 deletions
|
@ -412,12 +412,11 @@ describe('Notes', () => {
|
|||
.expect('Content-Type', /json/)
|
||||
.expect(200);
|
||||
expect(responseAfter.body).toHaveLength(1);
|
||||
expect(responseAfter.body[0].url).toEqual(upload0.fileUrl);
|
||||
expect(responseAfter.body[0].url).not.toEqual(upload1.fileUrl);
|
||||
expect(responseAfter.body[0].id).toEqual(upload0.id);
|
||||
expect(responseAfter.body[0].id).not.toEqual(upload1.id);
|
||||
for (const upload of [upload0, upload1]) {
|
||||
const fileName = upload.fileUrl.replace('/uploads/', '');
|
||||
// delete the file afterwards
|
||||
await fs.unlink(join(uploadPath, fileName));
|
||||
await fs.unlink(join(uploadPath, upload.id));
|
||||
}
|
||||
await fs.rm(uploadPath, { recursive: true });
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue