Skip to content

Commit 612efd7

Browse files
committed
Merge pull request parse-community#833 from ParsePlatform/nlutsenko.filesize
Remove client-side PFFile size limitation.
2 parents b0f9b49 + 62bf25e commit 612efd7

File tree

2 files changed

+0
-40
lines changed

2 files changed

+0
-40
lines changed

Parse/PFFile.m

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
#import "PFUserPrivate.h"
3030
#import "Parse_Private.h"
3131

32-
static const unsigned long long PFFileMaxFileSize = 10 * 1024 * 1024; // 10 MB
33-
3432
@interface PFFile () {
3533
dispatch_queue_t _synchronizationQueue;
3634
}
@@ -84,19 +82,6 @@ + (instancetype)fileWithName:(NSString *)name contentsAtPath:(NSString *)path er
8482
return nil;
8583
}
8684

87-
NSDictionary *attributes = [fileManager attributesOfItemAtPath:path error:nil];
88-
unsigned long long length = [attributes[NSFileSize] unsignedLongValue];
89-
if (length > PFFileMaxFileSize) {
90-
NSString *message = [NSString stringWithFormat:@"Failed to create PFFile at path '%@': file is larger than %lluMB.",
91-
path, (PFFileMaxFileSize >> 20)];
92-
if (error) {
93-
*error = [NSError errorWithDomain:NSCocoaErrorDomain
94-
code:NSFileReadTooLargeError
95-
userInfo:@{ NSLocalizedDescriptionKey : message }];
96-
}
97-
return nil;
98-
}
99-
10085
PFFile *file = [self fileWithName:name url:nil];
10186
if (![file _stageWithPath:path error:error]) {
10287
return nil;
@@ -127,17 +112,6 @@ + (instancetype)fileWithName:(NSString *)name
127112
return nil;
128113
}
129114

130-
if (data.length > PFFileMaxFileSize) {
131-
NSString *message = [NSString stringWithFormat:@"Failed to create PFFile with data: data is larger than %lluMB.",
132-
(PFFileMaxFileSize >> 20)];
133-
if (error) {
134-
*error = [NSError errorWithDomain:NSCocoaErrorDomain
135-
code:NSFileReadTooLargeError
136-
userInfo:@{ NSLocalizedDescriptionKey : message }];
137-
}
138-
return nil;
139-
}
140-
141115
PFFile *file = [[self alloc] initWithName:name urlString:nil mimeType:contentType];
142116
if (![file _stageWithData:data error:error]) {
143117
return nil;

Tests/Unit/FileUnitTests.m

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -189,20 +189,6 @@ - (void)testContructors {
189189
XCTAssertTrue(file.dataAvailable);
190190
}
191191

192-
- (void)testConstructorWithTooLargeData {
193-
NSMutableData *data = [NSMutableData dataWithLength:(10 * 1048576 + 1)];
194-
195-
NSError *error = nil;
196-
PFFile *file = [PFFile fileWithName:@"testFile"
197-
data:data
198-
contentType:nil
199-
error:&error];
200-
201-
XCTAssertNil(file);
202-
XCTAssertEqualObjects(NSCocoaErrorDomain, error.domain);
203-
XCTAssertEqual(NSFileReadTooLargeError, error.code);
204-
}
205-
206192
- (void)testConstructorWithNilData {
207193
NSMutableData *data = nil;
208194

0 commit comments

Comments
 (0)