Do not try to download text attachments

This commit is contained in:
Josh Perez 2022-04-08 13:03:10 -04:00 committed by GitHub
parent 0a0fabd2ca
commit 0f16ef5dd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 7 deletions

View file

@ -52,7 +52,7 @@ export const StoryImage = ({
return null;
}
const isPending = Boolean(attachment.pending);
const isPending = Boolean(attachment.pending) && !attachment.textAttachment;
const isNotReadyToShow = hasNotResolved(attachment) || isPending;
const getClassName = getClassNamesFor('StoryImage', moduleClassName);

View file

@ -2569,7 +2569,8 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
const shouldHoldOffDownload =
(isStory(message.attributes) && !queueStoryForDownload) ||
((isImage(attachments) || isVideo(attachments)) &&
(!isStory(message.attributes) &&
(isImage(attachments) || isVideo(attachments)) &&
isInCall(reduxState));
if (

View file

@ -110,7 +110,6 @@ import {
} from './messageReceiverEvents';
import * as log from '../logging/log';
import * as durations from '../util/durations';
import { IMAGE_JPEG } from '../types/MIME';
import { areArraysMatchingSets } from '../util/areArraysMatchingSets';
import { generateBlurHash } from '../util/generateBlurHash';
@ -1803,8 +1802,7 @@ export default class MessageReceiver
if (msg.textAttachment) {
attachments.push({
contentType: IMAGE_JPEG,
size: 0,
size: msg.textAttachment.text?.length,
textAttachment: msg.textAttachment,
blurHash: generateBlurHash(
(msg.textAttachment.color ||

View file

@ -723,7 +723,7 @@ export function isGIF(attachments?: ReadonlyArray<AttachmentType>): boolean {
}
export function isDownloaded(attachment?: AttachmentType): boolean {
return Boolean(attachment && attachment.path);
return Boolean(attachment && (attachment.path || attachment.textAttachment));
}
export function hasNotResolved(attachment?: AttachmentType): boolean {

View file

@ -81,7 +81,7 @@ export async function queueAttachmentDownloads(
return attachment;
}
// We've already downloaded this!
if (attachment.path) {
if (attachment.path || attachment.textAttachment) {
log.info(
`Normal attachment already downloaded for message ${idForLogging}`
);