Limit unnecessary thumbnail generation

This commit is contained in:
trevor-signal
2025-09-24 10:55:08 -04:00
committed by GitHub
parent 9c97d3e73c
commit 74e327a6c4
14 changed files with 132 additions and 81 deletions

View File

@@ -49,7 +49,7 @@ import type {
} from '../types/CallLink.js';
import type {
AttachmentDownloadJobType,
AttachmentDownloadJobTypeType,
MessageAttachmentType,
} from '../types/AttachmentDownload.js';
import type {
GroupSendEndorsementsData,
@@ -651,7 +651,7 @@ export const MESSAGE_ATTACHMENT_COLUMNS = [
export type MessageAttachmentDBType = {
messageId: string;
attachmentType: AttachmentDownloadJobTypeType;
attachmentType: MessageAttachmentType;
orderInMessage: number;
editHistoryIndex: number | null;
conversationId: string;

View File

@@ -86,7 +86,7 @@ import {
} from '../types/AttachmentBackup.js';
import {
attachmentDownloadJobSchema,
type AttachmentDownloadJobTypeType,
type MessageAttachmentType,
type AttachmentDownloadJobType,
} from '../types/AttachmentDownload.js';
import type {
@@ -2700,7 +2700,7 @@ function saveMessageAttachment({
sentAt: number;
receivedAt: number;
receivedAtMs: number | undefined;
attachmentType: AttachmentDownloadJobTypeType;
attachmentType: MessageAttachmentType;
attachment: AttachmentType;
orderInMessage: number;
editHistoryIndex: number | null;

View File

@@ -6,9 +6,9 @@ import * as z from 'zod';
import type { LoggerType } from '../../types/Logging.js';
import {
attachmentDownloadTypeSchema,
messageAttachmentTypeSchema,
type AttachmentDownloadJobType,
type AttachmentDownloadJobTypeType,
type MessageAttachmentType,
} from '../../types/AttachmentDownload.js';
import type { AttachmentType } from '../../types/Attachment.js';
import { jsonToObject, objectToJSON, sql } from '../util.js';
@@ -28,7 +28,7 @@ export type _AttachmentDownloadJobTypeV1030 = {
messageId: string;
pending: number;
timestamp: number;
type: AttachmentDownloadJobTypeType;
type: MessageAttachmentType;
};
const attachmentDownloadJobSchemaV1040 = z
@@ -36,7 +36,7 @@ const attachmentDownloadJobSchemaV1040 = z
attachment: z
.object({ size: z.number(), contentType: MIMETypeSchema })
.passthrough(),
attachmentType: attachmentDownloadTypeSchema,
attachmentType: messageAttachmentTypeSchema,
ciphertextSize: z.number(),
contentType: MIMETypeSchema,
digest: z.string(),

View File

@@ -3,7 +3,7 @@
import { z } from 'zod';
import { convertUndefinedToNull } from '../../util/dropNull.js';
import { attachmentDownloadTypeSchema } from '../../types/AttachmentDownload.js';
import { messageAttachmentTypeSchema } from '../../types/AttachmentDownload.js';
import { APPLICATION_OCTET_STREAM } from '../../types/MIME.js';
import type { MessageAttachmentDBType } from '../Interface.js';
@@ -35,7 +35,7 @@ export const permissiveMessageAttachmentSchema = z.object({
messageId: z.string(),
messageType: z.string(),
editHistoryIndex: z.number(),
attachmentType: attachmentDownloadTypeSchema,
attachmentType: messageAttachmentTypeSchema,
orderInMessage: z.number(),
conversationId: z.string(),
sentAt: z.number().catch(0),