mirror of
https://github.com/immich-app/immich.git
synced 2025-12-23 17:25:11 +03:00
chore(server): save original file name with extension (#7679)
* chore(server): save original file name with extension * extract extension * update e2e test * update e2e test * download archive * fix download archive appending name * pr feedback * remove unused code * test * unit test * remove unused code * migration * noops * pr feedback * Update server/src/domain/download/download.service.ts Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com> --------- Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddExtensionToOriginalFileName1709763765506 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
WITH extension AS (WITH cte AS (SELECT a.id, STRING_TO_ARRAY(a."originalPath", '.')::TEXT[] AS arr
|
||||
FROM assets a)
|
||||
SELECT cte.id, cte.arr[ARRAY_UPPER(cte.arr, 1)] AS "ext"
|
||||
FROM cte)
|
||||
UPDATE assets
|
||||
SET "originalFileName" = assets."originalFileName" || '.' || extension."ext"
|
||||
FROM extension
|
||||
INNER JOIN assets a ON a.id = extension.id;
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(): Promise<void> {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user