Skip to content

Commit

Permalink
FIRStorageUploadTask: validate content just before uploading (#2350)
Browse files Browse the repository at this point in the history
  • Loading branch information
maksymmalyhin committed Mar 3, 2019
1 parent 6c4ee95 commit d376ee1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Firebase/Storage/FIRStorageUploadTask.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,20 @@ - (void)dealloc {
- (void)enqueue {
__weak FIRStorageUploadTask *weakSelf = self;

NSError *contentValidationError;
if (![self isContentToUploadValid:&contentValidationError]) {
self.error = contentValidationError;
[self finishTaskWithStatus:FIRStorageTaskStatusFailure snapshot:self.snapshot];
return;
}

[self dispatchAsync:^() {
FIRStorageUploadTask *strongSelf = weakSelf;

if (!strongSelf) {
return;
}

NSError *contentValidationError;
if (![strongSelf isContentToUploadValid:&contentValidationError]) {
strongSelf.error = contentValidationError;
[strongSelf finishTaskWithStatus:FIRStorageTaskStatusFailure snapshot:strongSelf.snapshot];
return;
}

strongSelf.state = FIRStorageTaskStateQueueing;

NSMutableURLRequest *request = [strongSelf.baseRequest mutableCopy];
Expand Down

0 comments on commit d376ee1

Please sign in to comment.