PR Feedback
This commit is contained in:
parent
9b33de1bde
commit
af10d28fc3
@ -29,7 +29,7 @@ typedef NS_ENUM(NSUInteger, TSAttachmentType) {
|
||||
@property (atomic) NSString *cdnKey;
|
||||
@property (atomic) UInt32 cdnNumber;
|
||||
@property (atomic, readwrite, nullable) NSData *encryptionKey;
|
||||
@property (nonatomic) NSString *contentType;
|
||||
@property (nonatomic, readonly) NSString *contentType;
|
||||
@property (nonatomic) TSAttachmentType attachmentType;
|
||||
|
||||
// Though now required, may incorrectly be 0 on legacy attachments.
|
||||
@ -141,6 +141,10 @@ NS_DESIGNATED_INITIALIZER NS_SWIFT_NAME(init(grdbId:uniqueId:albumMessageId:atta
|
||||
|
||||
+ (NSString *)emojiForMimeType:(NSString *)contentType;
|
||||
|
||||
// This should only ever be used before the attachment is saved,
|
||||
// after that point the content type will be already set.
|
||||
- (void)setDefaultContentType:(NSString *)contentType;
|
||||
|
||||
#pragma mark - Update With...
|
||||
|
||||
- (void)updateWithBlurHash:(NSString *)blurHash transaction:(SDSAnyWriteTransaction *)transaction;
|
||||
|
||||
@ -456,6 +456,13 @@ NSUInteger const TSAttachmentSchemaVersion = 5;
|
||||
[self.attachmentReadCache didRemoveAttachment:self transaction:transaction];
|
||||
}
|
||||
|
||||
- (void)setDefaultContentType:(NSString *)contentType
|
||||
{
|
||||
if ([self.contentType isEqualToString:OWSMimeTypeApplicationOctetStream]) {
|
||||
_contentType = contentType;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Update With...
|
||||
|
||||
- (void)updateWithBlurHash:(NSString *)blurHash transaction:(SDSAnyWriteTransaction *)transaction
|
||||
|
||||
@ -154,10 +154,7 @@ public class MessageSticker: MTLModel {
|
||||
throw StickerError.invalidInput
|
||||
}
|
||||
|
||||
if dataProto.contentType?.isEmpty != false && attachmentPointer.contentType == OWSMimeTypeApplicationOctetStream {
|
||||
Logger.warn("Assuming sticker is webp, received with unspecified content-type")
|
||||
attachmentPointer.contentType = OWSMimeTypeImageWebp
|
||||
}
|
||||
attachmentPointer.setDefaultContentType(OWSMimeTypeImageWebp)
|
||||
|
||||
attachmentPointer.anyInsert(transaction: transaction)
|
||||
return attachmentPointer
|
||||
|
||||
Loading…
Reference in New Issue
Block a user