fix(paperless): Anpassung an Paperless-NGX 3.4 (API v10)
Build and Push Multi-Platform Images / build-and-push (push) Successful in 31s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 31s
- Task-Status: getTask() normalisiert die paginierte v10-Antwort (status klein, result_data, related_document_ids). Bisher wurde jede Task als „nicht gefunden“ gelöscht, ohne Nachbearbeitung. - Checksummen: Paperless ≥ 3.0 nutzt SHA-256 statt MD5. Duplikatprüfung umgestellt; Migration verbreitert Attachments.Checksum und berechnet Bestandswerte per SHA2() neu. - Custom-Field-Suche über custom_field_query, der alte Filter wurde von Paperless ignoriert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
33457c19c2
commit
4f34855c12
10 files changed
+218
-40
No files matched your search
@@ -28,7 +28,8 @@ export class Attachment {
|
||||
@Column({ type: 'tinyint', width: 1 })
|
||||
Erechnung!: boolean;
|
||||
|
||||
@Column({ type: 'varchar', length: 32, default: '' })
|
||||
/** SHA-256 der Datei — entspricht der Checksumme in Paperless ≥ 3.0 */
|
||||
@Column({ type: 'varchar', length: 64, default: '' })
|
||||
Checksum!: string;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
/**
|
||||
* Paperless-NGX ≥ 3.0 speichert Checksummen als SHA-256 statt MD5. Damit der
|
||||
* Duplikat-Abgleich (`checksum__iexact`) wieder trifft, wird
|
||||
* `Attachments.Checksum` auf 64 Zeichen verbreitert und für alle Anhänge mit
|
||||
* gespeichertem Inhalt direkt in der Datenbank neu berechnet.
|
||||
*/
|
||||
export class AttachmentChecksumSha2561793500000000 implements MigrationInterface {
|
||||
name = 'AttachmentChecksumSha2561793500000000';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`Attachments\`
|
||||
MODIFY \`Checksum\` varchar(64) NOT NULL DEFAULT ''
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
UPDATE \`Attachments\` a
|
||||
INNER JOIN \`Contents\` c ON c.\`AttachmentEntityId\` = a.\`Id\`
|
||||
SET a.\`Checksum\` = SHA2(c.\`Content\`, 256)
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
UPDATE \`Attachments\` a
|
||||
INNER JOIN \`Contents\` c ON c.\`AttachmentEntityId\` = a.\`Id\`
|
||||
SET a.\`Checksum\` = MD5(c.\`Content\`)
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`Attachments\`
|
||||
MODIFY \`Checksum\` varchar(32) NOT NULL DEFAULT ''
|
||||
`);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user