Update Riot/Utils/FormattedBodyParser.swift

Co-authored-by: SBiOSoftWhare <SBiOSoftWhare@users.noreply.github.com>
This commit is contained in:
ismailgulek 2020-07-16 18:41:25 +03:00 committed by GitHub
parent 88df490608
commit 10ab22556f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,7 +46,10 @@ final class FormattedBodyParser: NSObject {
return nil
}
let urlString = String(formattedBody[urlRange])
let content = (formattedBody as NSString).substring(with: result.range(at: 2))
guard let contentRange = Range(result.range(at: 2), in: formattedBody) else {
return nil
}
let content = String(formattedBody[contentRange])
// ignore invalid urls
guard let link = URL(string: urlString) else { return nil }
// ignore other links