diff --git a/Sources/Storage/Storage.swift b/Sources/Storage/Storage.swift index 230c1f2..a768306 100644 --- a/Sources/Storage/Storage.swift +++ b/Sources/Storage/Storage.swift @@ -217,15 +217,15 @@ public class Storage { } /// Appends the asset's path with the base CDN URL. With support for optional - public static func getCDNPath(for path: String?) throws -> String? { - guard let cdnBaseURL = cdnBaseURL else { - throw Error.cdnBaseURLNotSet - } - + public static func getCDNPath(optional path: String?) throws -> String? { guard let pathUnwrapped = path else { return nil } + guard let cdnBaseURL = cdnBaseURL else { + throw Error.cdnBaseURLNotSet + } + if let cdnPathBuilder = cdnPathBuilder { return cdnPathBuilder(cdnBaseURL, pathUnwrapped) }