mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix: redirect original (#27759)
This commit is contained in:
@@ -166,11 +166,16 @@ describe(AssetMediaController.name, () => {
|
||||
});
|
||||
|
||||
// TODO figure out how to deal with `sendFile`
|
||||
describe.skip('GET /assets/:id/thumbnail', () => {
|
||||
it('should be an authenticated route', async () => {
|
||||
describe('GET /assets/:id/thumbnail', () => {
|
||||
it.skip('should be an authenticated route', async () => {
|
||||
await request(ctx.getHttpServer()).get(`/assets/${factory.uuid()}/thumbnail`);
|
||||
expect(ctx.authenticate).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should redirect if size=original is requested', async () => {
|
||||
const { status } = await request(ctx.getHttpServer()).get(`/assets/${factory.uuid()}/thumbnail?size=original`);
|
||||
expect(status).toBe(302);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -126,6 +126,16 @@ export class AssetMediaController {
|
||||
@Res() res: Response,
|
||||
@Next() next: NextFunction,
|
||||
) {
|
||||
if (dto.size === AssetMediaSize.Original) {
|
||||
this.logger.deprecate(
|
||||
'Calling the thumbnail endpoint with size=original is deprecated. Use the :id/original endpoint instead',
|
||||
);
|
||||
const [_, reqSearch] = req.url.split('?');
|
||||
const redirSearchParams = new URLSearchParams(reqSearch);
|
||||
redirSearchParams.delete('size');
|
||||
return res.redirect('original' + '?' + redirSearchParams.toString());
|
||||
}
|
||||
|
||||
const viewThumbnailRes = await this.service.viewThumbnail(auth, id, dto);
|
||||
|
||||
if (viewThumbnailRes instanceof ImmichFileResponse) {
|
||||
|
||||
Reference in New Issue
Block a user