File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
WooCommerce/Classes/System Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -270,10 +270,14 @@ private extension WooConstants.URLs {
270270 /// Convert a `string` to a `URL`. Crash if it is malformed.
271271 ///
272272 private static func trustedURL( _ url: String ) -> URL {
273- guard let url = URL ( string: url) else {
274- let fallback = URL ( string: url. addingPercentEncoding ( withAllowedCharacters: NSCharacterSet . urlQueryAllowed) ?? " " )
275- return fallback ?? URL ( string: " " ) !
273+
274+ if let url = URL ( string: url) {
275+ return url
276+ } else if let escapedString = url. addingPercentEncoding ( withAllowedCharacters: NSCharacterSet . urlQueryAllowed) ,
277+ let escapedURL = URL ( string: escapedString) {
278+ return escapedURL
279+ } else {
280+ fatalError ( " Expected URL \( url) to be a well-formed URL. " )
276281 }
277- return url
278282 }
279283}
You can’t perform that action at this time.
0 commit comments