Skip to content

Commit f5a9389

Browse files
committed
fix: file:// crash issue of iOS for 14.3 OS version
1 parent 163ff05 commit f5a9389

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ios/Video/VideoCompressor.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ class VideoCompressor: RCTEventEmitter, URLSessionTaskDelegate {
8484
}
8585

8686
@objc(upload:withOptions:withResolver:withRejecter:)
87-
func upload(fileUrl: String, options: [String: Any], resolve:@escaping RCTPromiseResolveBlock, reject:@escaping RCTPromiseRejectBlock) -> Void {
87+
func upload(filePath: String, options: [String: Any], resolve:@escaping RCTPromiseResolveBlock, reject:@escaping RCTPromiseRejectBlock) -> Void {
88+
let fileWithUrl = URL(fileURLWithPath: filePath)
89+
let absoluteUrl = fileWithUrl.deletingLastPathComponent()
90+
let fileUrl = "file://\(absoluteUrl.path)/\(fileWithUrl.lastPathComponent)"
91+
8892
guard let uuid = options["uuid"] as? String else {
8993
let uploadError = UploadError(message: "UUID is missing")
9094
reject("Upload Failed", "UUID is missing", uploadError)

0 commit comments

Comments
 (0)