Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 9 years ago
parent 40dcc7c873
commit fa2ff8158c

@ -39,12 +39,16 @@ message Content {
message CallMessage { message CallMessage {
message Offer { message Offer {
optional uint64 id = 1; optional uint64 id = 1;
optional string description = 2; // We've renamed the description field on iOS to avoid
// conflicts with [NSObject description].
optional string sessionDescription = 2;
} }
message Answer { message Answer {
optional uint64 id = 1; optional uint64 id = 1;
optional string description = 2; // We've renamed the description field on iOS to avoid
// conflicts with [NSObject description].
optional string sessionDescription = 2;
} }
message IceUpdate { message IceUpdate {

@ -23,7 +23,6 @@ typedef NS_ENUM(NSInteger, TSGroupMetaMessage) {
@interface TSMessage : TSInteraction @interface TSMessage : TSInteraction
@property (nonatomic, readonly) NSMutableArray<NSString *> *attachmentIds; @property (nonatomic, readonly) NSMutableArray<NSString *> *attachmentIds;
// A map of attachment id-to-filename.
@property (nullable, nonatomic) NSString *body; @property (nullable, nonatomic) NSString *body;
@property (nonatomic) TSGroupMetaMessage groupMetaMessage; @property (nonatomic) TSGroupMetaMessage groupMetaMessage;
@property (nonatomic) uint32_t expiresInSeconds; @property (nonatomic) uint32_t expiresInSeconds;

@ -57,6 +57,7 @@ typedef NS_ENUM(NSInteger, TSOutgoingMessageState) {
@property BOOL hasSyncedTranscript; @property BOOL hasSyncedTranscript;
@property NSString *customMessage; @property NSString *customMessage;
@property (atomic, readonly) NSString *mostRecentFailureText; @property (atomic, readonly) NSString *mostRecentFailureText;
// A map of attachment id-to-filename.
@property (nonatomic, readonly) NSMutableDictionary<NSString *, NSString *> *attachmentFilenameMap; @property (nonatomic, readonly) NSMutableDictionary<NSString *, NSString *> *attachmentFilenameMap;
/** /**

@ -1,5 +1,6 @@
// Created by Michael Kirk on 12/1/16. //
// Copyright © 2016 Open Whisper Systems. All rights reserved. // Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "OWSCallAnswerMessage.h" #import "OWSCallAnswerMessage.h"
#import "OWSSignalServiceProtos.pb.h" #import "OWSSignalServiceProtos.pb.h"
@ -26,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSSignalServiceProtosCallMessageAnswerBuilder *builder = [OWSSignalServiceProtosCallMessageAnswerBuilder new]; OWSSignalServiceProtosCallMessageAnswerBuilder *builder = [OWSSignalServiceProtosCallMessageAnswerBuilder new];
builder.id = self.callId; builder.id = self.callId;
[builder setDescription:self.sessionDescription]; builder.sessionDescription = self.sessionDescription;
return [builder build]; return [builder build];
} }

@ -1,5 +1,6 @@
// Created by Michael Kirk on 12/1/16. //
// Copyright © 2016 Open Whisper Systems. All rights reserved. // Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "OWSCallOfferMessage.h" #import "OWSCallOfferMessage.h"
#import "OWSSignalServiceProtos.pb.h" #import "OWSSignalServiceProtos.pb.h"
@ -26,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSSignalServiceProtosCallMessageOfferBuilder *builder = [OWSSignalServiceProtosCallMessageOfferBuilder new]; OWSSignalServiceProtosCallMessageOfferBuilder *builder = [OWSSignalServiceProtosCallMessageOfferBuilder new];
builder.id = self.callId; builder.id = self.callId;
[builder setDescription:self.sessionDescription]; builder.sessionDescription = self.sessionDescription;
return [builder build]; return [builder build];
} }

@ -1,4 +1,6 @@
// Generated by the protocol buffer compiler. DO NOT EDIT! //
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import <ProtocolBuffers/ProtocolBuffers.h> #import <ProtocolBuffers/ProtocolBuffers.h>
@ -374,18 +376,18 @@ NSString *NSStringFromOWSSignalServiceProtosGroupContextType(OWSSignalServicePro
@end @end
#define Offer_id @"id" #define Offer_id @"id"
#define Offer_description @"pb_description" #define Offer_sessionDescription @"sessionDescription"
@interface OWSSignalServiceProtosCallMessageOffer : PBGeneratedMessage<GeneratedMessageProtocol> { @interface OWSSignalServiceProtosCallMessageOffer : PBGeneratedMessage<GeneratedMessageProtocol> {
@private @private
BOOL hasId_:1; BOOL hasId_:1;
BOOL hasDescription_:1; BOOL hasSessionDescription_:1;
UInt64 id; UInt64 id;
NSString* pb_description; NSString* sessionDescription;
} }
- (BOOL) hasId; - (BOOL) hasId;
- (BOOL) hasDescription; - (BOOL) hasSessionDescription;
@property (readonly) UInt64 id; @property (readonly) UInt64 id;
@property (readonly, strong) NSString* pb_description; @property (readonly, strong) NSString* sessionDescription;
+ (instancetype) defaultInstance; + (instancetype) defaultInstance;
- (instancetype) defaultInstance; - (instancetype) defaultInstance;
@ -427,25 +429,25 @@ NSString *NSStringFromOWSSignalServiceProtosGroupContextType(OWSSignalServicePro
- (OWSSignalServiceProtosCallMessageOfferBuilder*) setId:(UInt64) value; - (OWSSignalServiceProtosCallMessageOfferBuilder*) setId:(UInt64) value;
- (OWSSignalServiceProtosCallMessageOfferBuilder*) clearId; - (OWSSignalServiceProtosCallMessageOfferBuilder*) clearId;
- (BOOL) hasDescription; - (BOOL) hasSessionDescription;
- (NSString*) pb_description; - (NSString*) sessionDescription;
- (OWSSignalServiceProtosCallMessageOfferBuilder*) setDescription:(NSString*) value; - (OWSSignalServiceProtosCallMessageOfferBuilder*) setSessionDescription:(NSString*) value;
- (OWSSignalServiceProtosCallMessageOfferBuilder*) clearDescription; - (OWSSignalServiceProtosCallMessageOfferBuilder*) clearSessionDescription;
@end @end
#define Answer_id @"id" #define Answer_id @"id"
#define Answer_description @"pb_description" #define Answer_sessionDescription @"sessionDescription"
@interface OWSSignalServiceProtosCallMessageAnswer : PBGeneratedMessage<GeneratedMessageProtocol> { @interface OWSSignalServiceProtosCallMessageAnswer : PBGeneratedMessage<GeneratedMessageProtocol> {
@private @private
BOOL hasId_:1; BOOL hasId_:1;
BOOL hasDescription_:1; BOOL hasSessionDescription_:1;
UInt64 id; UInt64 id;
NSString* pb_description; NSString* sessionDescription;
} }
- (BOOL) hasId; - (BOOL) hasId;
- (BOOL) hasDescription; - (BOOL) hasSessionDescription;
@property (readonly) UInt64 id; @property (readonly) UInt64 id;
@property (readonly, strong) NSString* pb_description; @property (readonly, strong) NSString* sessionDescription;
+ (instancetype) defaultInstance; + (instancetype) defaultInstance;
- (instancetype) defaultInstance; - (instancetype) defaultInstance;
@ -487,10 +489,10 @@ NSString *NSStringFromOWSSignalServiceProtosGroupContextType(OWSSignalServicePro
- (OWSSignalServiceProtosCallMessageAnswerBuilder*) setId:(UInt64) value; - (OWSSignalServiceProtosCallMessageAnswerBuilder*) setId:(UInt64) value;
- (OWSSignalServiceProtosCallMessageAnswerBuilder*) clearId; - (OWSSignalServiceProtosCallMessageAnswerBuilder*) clearId;
- (BOOL) hasDescription; - (BOOL) hasSessionDescription;
- (NSString*) pb_description; - (NSString*) sessionDescription;
- (OWSSignalServiceProtosCallMessageAnswerBuilder*) setDescription:(NSString*) value; - (OWSSignalServiceProtosCallMessageAnswerBuilder*) setSessionDescription:(NSString*) value;
- (OWSSignalServiceProtosCallMessageAnswerBuilder*) clearDescription; - (OWSSignalServiceProtosCallMessageAnswerBuilder*) clearSessionDescription;
@end @end
#define IceUpdate_id @"id" #define IceUpdate_id @"id"

@ -1,4 +1,6 @@
// Generated by the protocol buffer compiler. DO NOT EDIT! //
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "OWSSignalServiceProtos.pb.h" #import "OWSSignalServiceProtos.pb.h"
// @@protoc_insertion_point(imports) // @@protoc_insertion_point(imports)
@ -1180,7 +1182,7 @@ static OWSSignalServiceProtosCallMessage* defaultOWSSignalServiceProtosCallMessa
@interface OWSSignalServiceProtosCallMessageOffer () @interface OWSSignalServiceProtosCallMessageOffer ()
@property UInt64 id; @property UInt64 id;
@property (strong) NSString* pb_description; @property (strong) NSString* sessionDescription;
@end @end
@implementation OWSSignalServiceProtosCallMessageOffer @implementation OWSSignalServiceProtosCallMessageOffer
@ -1192,17 +1194,17 @@ static OWSSignalServiceProtosCallMessage* defaultOWSSignalServiceProtosCallMessa
hasId_ = !!_value_; hasId_ = !!_value_;
} }
@synthesize id; @synthesize id;
- (BOOL) hasDescription { - (BOOL) hasSessionDescription {
return !!hasDescription_; return !!hasSessionDescription_;
} }
- (void) setHasDescription:(BOOL) _value_ { - (void) setHasSessionDescription:(BOOL) _value_ {
hasDescription_ = !!_value_; hasSessionDescription_ = !!_value_;
} }
@synthesize pb_description; @synthesize sessionDescription;
- (instancetype) init { - (instancetype) init {
if ((self = [super init])) { if ((self = [super init])) {
self.id = 0L; self.id = 0L;
self.pb_description = @""; self.sessionDescription = @"";
} }
return self; return self;
} }
@ -1225,8 +1227,8 @@ static OWSSignalServiceProtosCallMessageOffer* defaultOWSSignalServiceProtosCall
if (self.hasId) { if (self.hasId) {
[output writeUInt64:1 value:self.id]; [output writeUInt64:1 value:self.id];
} }
if (self.hasDescription) { if (self.hasSessionDescription) {
[output writeString:2 value:self.pb_description]; [output writeString:2 value:self.sessionDescription];
} }
[self.unknownFields writeToCodedOutputStream:output]; [self.unknownFields writeToCodedOutputStream:output];
} }
@ -1240,8 +1242,8 @@ static OWSSignalServiceProtosCallMessageOffer* defaultOWSSignalServiceProtosCall
if (self.hasId) { if (self.hasId) {
size_ += computeUInt64Size(1, self.id); size_ += computeUInt64Size(1, self.id);
} }
if (self.hasDescription) { if (self.hasSessionDescription) {
size_ += computeStringSize(2, self.pb_description); size_ += computeStringSize(2, self.sessionDescription);
} }
size_ += self.unknownFields.serializedSize; size_ += self.unknownFields.serializedSize;
memoizedSerializedSize = size_; memoizedSerializedSize = size_;
@ -1281,8 +1283,8 @@ static OWSSignalServiceProtosCallMessageOffer* defaultOWSSignalServiceProtosCall
if (self.hasId) { if (self.hasId) {
[output appendFormat:@"%@%@: %@\n", indent, @"id", [NSNumber numberWithLongLong:self.id]]; [output appendFormat:@"%@%@: %@\n", indent, @"id", [NSNumber numberWithLongLong:self.id]];
} }
if (self.hasDescription) { if (self.hasSessionDescription) {
[output appendFormat:@"%@%@: %@\n", indent, @"pb_description", self.pb_description]; [output appendFormat:@"%@%@: %@\n", indent, @"sessionDescription", self.sessionDescription];
} }
[self.unknownFields writeDescriptionTo:output withIndent:indent]; [self.unknownFields writeDescriptionTo:output withIndent:indent];
} }
@ -1290,8 +1292,8 @@ static OWSSignalServiceProtosCallMessageOffer* defaultOWSSignalServiceProtosCall
if (self.hasId) { if (self.hasId) {
[dictionary setObject: [NSNumber numberWithLongLong:self.id] forKey: @"id"]; [dictionary setObject: [NSNumber numberWithLongLong:self.id] forKey: @"id"];
} }
if (self.hasDescription) { if (self.hasSessionDescription) {
[dictionary setObject: self.pb_description forKey: @"pb_description"]; [dictionary setObject: self.sessionDescription forKey: @"sessionDescription"];
} }
[self.unknownFields storeInDictionary:dictionary]; [self.unknownFields storeInDictionary:dictionary];
} }
@ -1306,8 +1308,8 @@ static OWSSignalServiceProtosCallMessageOffer* defaultOWSSignalServiceProtosCall
return return
self.hasId == otherMessage.hasId && self.hasId == otherMessage.hasId &&
(!self.hasId || self.id == otherMessage.id) && (!self.hasId || self.id == otherMessage.id) &&
self.hasDescription == otherMessage.hasDescription && self.hasSessionDescription == otherMessage.hasSessionDescription &&
(!self.hasDescription || [self.pb_description isEqual:otherMessage.pb_description]) && (!self.hasSessionDescription || [self.sessionDescription isEqual:otherMessage.sessionDescription]) &&
(self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields]));
} }
- (NSUInteger) hash { - (NSUInteger) hash {
@ -1315,8 +1317,8 @@ static OWSSignalServiceProtosCallMessageOffer* defaultOWSSignalServiceProtosCall
if (self.hasId) { if (self.hasId) {
hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.id] hash]; hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.id] hash];
} }
if (self.hasDescription) { if (self.hasSessionDescription) {
hashCode = hashCode * 31 + [self.pb_description hash]; hashCode = hashCode * 31 + [self.sessionDescription hash];
} }
hashCode = hashCode * 31 + [self.unknownFields hash]; hashCode = hashCode * 31 + [self.unknownFields hash];
return hashCode; return hashCode;
@ -1364,8 +1366,8 @@ static OWSSignalServiceProtosCallMessageOffer* defaultOWSSignalServiceProtosCall
if (other.hasId) { if (other.hasId) {
[self setId:other.id]; [self setId:other.id];
} }
if (other.hasDescription) { if (other.hasSessionDescription) {
[self setDescription:other.pb_description]; [self setSessionDescription:other.sessionDescription];
} }
[self mergeUnknownFields:other.unknownFields]; [self mergeUnknownFields:other.unknownFields];
return self; return self;
@ -1393,7 +1395,7 @@ static OWSSignalServiceProtosCallMessageOffer* defaultOWSSignalServiceProtosCall
break; break;
} }
case 18: { case 18: {
[self setDescription:[input readString]]; [self setSessionDescription:[input readString]];
break; break;
} }
} }
@ -1415,27 +1417,27 @@ static OWSSignalServiceProtosCallMessageOffer* defaultOWSSignalServiceProtosCall
resultOffer.id = 0L; resultOffer.id = 0L;
return self; return self;
} }
- (BOOL) hasDescription { - (BOOL) hasSessionDescription {
return resultOffer.hasDescription; return resultOffer.hasSessionDescription;
} }
- (NSString*) pb_description { - (NSString*) sessionDescription {
return resultOffer.pb_description; return resultOffer.sessionDescription;
} }
- (OWSSignalServiceProtosCallMessageOfferBuilder*) setDescription:(NSString*) value { - (OWSSignalServiceProtosCallMessageOfferBuilder*) setSessionDescription:(NSString*) value {
resultOffer.hasDescription = YES; resultOffer.hasSessionDescription = YES;
resultOffer.pb_description = value; resultOffer.sessionDescription = value;
return self; return self;
} }
- (OWSSignalServiceProtosCallMessageOfferBuilder*) clearDescription { - (OWSSignalServiceProtosCallMessageOfferBuilder*) clearSessionDescription {
resultOffer.hasDescription = NO; resultOffer.hasSessionDescription = NO;
resultOffer.pb_description = @""; resultOffer.sessionDescription = @"";
return self; return self;
} }
@end @end
@interface OWSSignalServiceProtosCallMessageAnswer () @interface OWSSignalServiceProtosCallMessageAnswer ()
@property UInt64 id; @property UInt64 id;
@property (strong) NSString* pb_description; @property (strong) NSString* sessionDescription;
@end @end
@implementation OWSSignalServiceProtosCallMessageAnswer @implementation OWSSignalServiceProtosCallMessageAnswer
@ -1447,17 +1449,17 @@ static OWSSignalServiceProtosCallMessageOffer* defaultOWSSignalServiceProtosCall
hasId_ = !!_value_; hasId_ = !!_value_;
} }
@synthesize id; @synthesize id;
- (BOOL) hasDescription { - (BOOL) hasSessionDescription {
return !!hasDescription_; return !!hasSessionDescription_;
} }
- (void) setHasDescription:(BOOL) _value_ { - (void) setHasSessionDescription:(BOOL) _value_ {
hasDescription_ = !!_value_; hasSessionDescription_ = !!_value_;
} }
@synthesize pb_description; @synthesize sessionDescription;
- (instancetype) init { - (instancetype) init {
if ((self = [super init])) { if ((self = [super init])) {
self.id = 0L; self.id = 0L;
self.pb_description = @""; self.sessionDescription = @"";
} }
return self; return self;
} }
@ -1480,8 +1482,8 @@ static OWSSignalServiceProtosCallMessageAnswer* defaultOWSSignalServiceProtosCal
if (self.hasId) { if (self.hasId) {
[output writeUInt64:1 value:self.id]; [output writeUInt64:1 value:self.id];
} }
if (self.hasDescription) { if (self.hasSessionDescription) {
[output writeString:2 value:self.pb_description]; [output writeString:2 value:self.sessionDescription];
} }
[self.unknownFields writeToCodedOutputStream:output]; [self.unknownFields writeToCodedOutputStream:output];
} }
@ -1495,8 +1497,8 @@ static OWSSignalServiceProtosCallMessageAnswer* defaultOWSSignalServiceProtosCal
if (self.hasId) { if (self.hasId) {
size_ += computeUInt64Size(1, self.id); size_ += computeUInt64Size(1, self.id);
} }
if (self.hasDescription) { if (self.hasSessionDescription) {
size_ += computeStringSize(2, self.pb_description); size_ += computeStringSize(2, self.sessionDescription);
} }
size_ += self.unknownFields.serializedSize; size_ += self.unknownFields.serializedSize;
memoizedSerializedSize = size_; memoizedSerializedSize = size_;
@ -1536,8 +1538,8 @@ static OWSSignalServiceProtosCallMessageAnswer* defaultOWSSignalServiceProtosCal
if (self.hasId) { if (self.hasId) {
[output appendFormat:@"%@%@: %@\n", indent, @"id", [NSNumber numberWithLongLong:self.id]]; [output appendFormat:@"%@%@: %@\n", indent, @"id", [NSNumber numberWithLongLong:self.id]];
} }
if (self.hasDescription) { if (self.hasSessionDescription) {
[output appendFormat:@"%@%@: %@\n", indent, @"pb_description", self.pb_description]; [output appendFormat:@"%@%@: %@\n", indent, @"sessionDescription", self.sessionDescription];
} }
[self.unknownFields writeDescriptionTo:output withIndent:indent]; [self.unknownFields writeDescriptionTo:output withIndent:indent];
} }
@ -1545,8 +1547,8 @@ static OWSSignalServiceProtosCallMessageAnswer* defaultOWSSignalServiceProtosCal
if (self.hasId) { if (self.hasId) {
[dictionary setObject: [NSNumber numberWithLongLong:self.id] forKey: @"id"]; [dictionary setObject: [NSNumber numberWithLongLong:self.id] forKey: @"id"];
} }
if (self.hasDescription) { if (self.hasSessionDescription) {
[dictionary setObject: self.pb_description forKey: @"pb_description"]; [dictionary setObject: self.sessionDescription forKey: @"sessionDescription"];
} }
[self.unknownFields storeInDictionary:dictionary]; [self.unknownFields storeInDictionary:dictionary];
} }
@ -1561,8 +1563,8 @@ static OWSSignalServiceProtosCallMessageAnswer* defaultOWSSignalServiceProtosCal
return return
self.hasId == otherMessage.hasId && self.hasId == otherMessage.hasId &&
(!self.hasId || self.id == otherMessage.id) && (!self.hasId || self.id == otherMessage.id) &&
self.hasDescription == otherMessage.hasDescription && self.hasSessionDescription == otherMessage.hasSessionDescription &&
(!self.hasDescription || [self.pb_description isEqual:otherMessage.pb_description]) && (!self.hasSessionDescription || [self.sessionDescription isEqual:otherMessage.sessionDescription]) &&
(self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields]));
} }
- (NSUInteger) hash { - (NSUInteger) hash {
@ -1570,8 +1572,8 @@ static OWSSignalServiceProtosCallMessageAnswer* defaultOWSSignalServiceProtosCal
if (self.hasId) { if (self.hasId) {
hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.id] hash]; hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.id] hash];
} }
if (self.hasDescription) { if (self.hasSessionDescription) {
hashCode = hashCode * 31 + [self.pb_description hash]; hashCode = hashCode * 31 + [self.sessionDescription hash];
} }
hashCode = hashCode * 31 + [self.unknownFields hash]; hashCode = hashCode * 31 + [self.unknownFields hash];
return hashCode; return hashCode;
@ -1619,8 +1621,8 @@ static OWSSignalServiceProtosCallMessageAnswer* defaultOWSSignalServiceProtosCal
if (other.hasId) { if (other.hasId) {
[self setId:other.id]; [self setId:other.id];
} }
if (other.hasDescription) { if (other.hasSessionDescription) {
[self setDescription:other.pb_description]; [self setSessionDescription:other.sessionDescription];
} }
[self mergeUnknownFields:other.unknownFields]; [self mergeUnknownFields:other.unknownFields];
return self; return self;
@ -1648,7 +1650,7 @@ static OWSSignalServiceProtosCallMessageAnswer* defaultOWSSignalServiceProtosCal
break; break;
} }
case 18: { case 18: {
[self setDescription:[input readString]]; [self setSessionDescription:[input readString]];
break; break;
} }
} }
@ -1670,20 +1672,20 @@ static OWSSignalServiceProtosCallMessageAnswer* defaultOWSSignalServiceProtosCal
resultAnswer.id = 0L; resultAnswer.id = 0L;
return self; return self;
} }
- (BOOL) hasDescription { - (BOOL) hasSessionDescription {
return resultAnswer.hasDescription; return resultAnswer.hasSessionDescription;
} }
- (NSString*) pb_description { - (NSString*) sessionDescription {
return resultAnswer.pb_description; return resultAnswer.sessionDescription;
} }
- (OWSSignalServiceProtosCallMessageAnswerBuilder*) setDescription:(NSString*) value { - (OWSSignalServiceProtosCallMessageAnswerBuilder*) setSessionDescription:(NSString*) value {
resultAnswer.hasDescription = YES; resultAnswer.hasSessionDescription = YES;
resultAnswer.pb_description = value; resultAnswer.sessionDescription = value;
return self; return self;
} }
- (OWSSignalServiceProtosCallMessageAnswerBuilder*) clearDescription { - (OWSSignalServiceProtosCallMessageAnswerBuilder*) clearSessionDescription {
resultAnswer.hasDescription = NO; resultAnswer.hasSessionDescription = NO;
resultAnswer.pb_description = @""; resultAnswer.sessionDescription = @"";
return self; return self;
} }
@end @end

@ -272,15 +272,20 @@ NSString *const OWSMimeTypeUnknownForTests = @"unknown/mimetype";
// Ensure that the filename is a valid filesystem name, // Ensure that the filename is a valid filesystem name,
// replacing invalid characters with an underscore. // replacing invalid characters with an underscore.
for (NSCharacterSet *invalidCharacterSet in @[ for (NSCharacterSet *invalidCharacterSet in @[
[NSCharacterSet whitespaceCharacterSet], [NSCharacterSet whitespaceAndNewlineCharacterSet],
[NSCharacterSet newlineCharacterSet],
[NSCharacterSet illegalCharacterSet], [NSCharacterSet illegalCharacterSet],
[NSCharacterSet controlCharacterSet], [NSCharacterSet controlCharacterSet],
[NSCharacterSet characterSetWithCharactersInString:@"<>|\\:()&;?*"], [NSCharacterSet characterSetWithCharactersInString:@"<>|\\:()&;?*/~"],
]) { ]) {
normalizedFilename = [[normalizedFilename componentsSeparatedByCharactersInSet:invalidCharacterSet] normalizedFilename = [[normalizedFilename componentsSeparatedByCharactersInSet:invalidCharacterSet]
componentsJoinedByString:@"_"]; componentsJoinedByString:@"_"];
} }
// Remove leading periods to prevent hidden files,
// "." and ".." special file names.
while ([normalizedFilename hasPrefix:@"."]) {
normalizedFilename = [normalizedFilename substringFromIndex:1];
}
NSString *fileExtension = [[normalizedFilename pathExtension] NSString *fileExtension = [[normalizedFilename pathExtension]
stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];

Loading…
Cancel
Save