Escape file paths to avoid crashes when paths include spaces

PiperOrigin-RevId: 438437189
This commit is contained in:
bourdakos
2022-03-30 17:26:43 -07:00
committed by Copybara-Service
parent a952c85e49
commit 267afabefd
@@ -147,8 +147,8 @@ void GNCPayloadListener::OnPayload(const std::string &endpoint_id, Payload paylo
case PayloadType::kFile:
if (handlers.filePayloadHandler) {
InputFile *payloadInputFile = payload.AsFile();
NSURL *fileURL =
[NSURL URLWithString:ObjCStringFromCppString(payloadInputFile->GetFilePath())];
NSString *fileString = ObjCStringFromCppString(payloadInputFile->GetFilePath());
NSURL *fileURL = [NSURL fileURLWithPath:fileString];
int64_t fileSize = payloadInputFile->GetTotalSize();
NSProgress *progress = [NSProgress progressWithTotalUnitCount:fileSize];
progress.cancellable = YES;