MESSENGER-4549 strict check for mapstyle url

This commit is contained in:
Frank Rotermund
2023-08-22 08:10:13 +02:00
parent c62942c44e
commit 8a18a2d5a2

View File

@@ -73,15 +73,16 @@ final class HomeserverConfigurationBuilder: NSObject {
// Tile server configuration
let tileServerMapStyleURL: URL
var tileServerMapStyleURL: URL = URL(string: BWIBuildSettings.shared.serverConfigDefaultMapstyleURLString)!
if let mapStyleURLString = wellKnown?.tileServer?.mapStyleURLString,
let mapStyleURL = URL(string: mapStyleURLString) {
tileServerMapStyleURL = mapStyleURL
} else {
tileServerMapStyleURL = URL(string: BWIBuildSettings.shared.serverConfigDefaultMapstyleURLString)!
if verifyUrl(url: mapStyleURL) {
tileServerMapStyleURL = mapStyleURL
}
}
let tileServerConfiguration = HomeserverTileServerConfiguration(mapStyleURL: tileServerMapStyleURL)
// Create HomeserverConfiguration
@@ -145,4 +146,8 @@ final class HomeserverConfigurationBuilder: NSObject {
return jitsiServerURL
}
private func verifyUrl (url: URL) -> Bool {
return UIApplication.shared.canOpenURL(url)
}
}