From 1e1981b2b152c175c005885587a44e231995d33f Mon Sep 17 00:00:00 2001 From: Koen Van Looveren Date: Tue, 20 Sep 2022 16:22:23 +0200 Subject: [PATCH] Updated the file implementation --- ios/Classes/FCPExtensions.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ios/Classes/FCPExtensions.swift b/ios/Classes/FCPExtensions.swift index c3d90ba1..c272eeb8 100644 --- a/ios/Classes/FCPExtensions.swift +++ b/ios/Classes/FCPExtensions.swift @@ -16,7 +16,7 @@ extension UIImage { func fromCorrectSource(name: String) -> UIImage { if (name.starts(with: "http")) { return fromUrl(url: name) - } else if (name.starts(with: "//")) { + } else if (name.starts(with: "file://")) { return fromFile(path: name) } return fromFlutterAsset(name: name) @@ -31,7 +31,8 @@ extension UIImage { @available(iOS 14.0, *) func fromFile(path: String) -> UIImage { - let image: UIImage? = UIImage(contentsOfFile: path) + let cleanPath = path.replacingOccurrences(of: "file://", with: "") + let image: UIImage? = UIImage(contentsOfFile: cleanPath) return image ?? UIImage(systemName: "questionmark")! }