|
|
|
@ -788,7 +788,7 @@ public class OWSLinkPreview: MTLModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var title: String?
|
|
|
|
|
if let rawTitle = NSRegularExpression.parseFirstMatch(pattern: "<meta\\s+property\\s*=\\s*\"og:title\"\\s+content\\s*=\\s*\"(.*?)\"\\s*/?>",
|
|
|
|
|
if let rawTitle = NSRegularExpression.parseFirstMatch(pattern: "<meta\\s+property\\s*=\\s*\"og:title\"\\s+[^>]*content\\s*=\\s*\"(.*?)\"\\s*[^>]*/?>",
|
|
|
|
|
text: linkText,
|
|
|
|
|
options: .dotMatchesLineSeparators) {
|
|
|
|
|
if let decodedTitle = decodeHTMLEntities(inString: rawTitle) {
|
|
|
|
@ -801,7 +801,7 @@ public class OWSLinkPreview: MTLModel {
|
|
|
|
|
|
|
|
|
|
Logger.verbose("title: \(String(describing: title))")
|
|
|
|
|
|
|
|
|
|
guard let rawImageUrlString = NSRegularExpression.parseFirstMatch(pattern: "<meta\\s+property\\s*=\\s*\"og:image\"\\s+content\\s*=\\s*\"(.*?)\"\\s*/?>", text: linkText) else {
|
|
|
|
|
guard let rawImageUrlString = NSRegularExpression.parseFirstMatch(pattern: "<meta\\s+property\\s*=\\s*\"og:image\"\\s+[^>]*content\\s*=\\s*\"(.*?)\"[^>]*/?>", text: linkText) else {
|
|
|
|
|
return OWSLinkPreviewContents(title: title)
|
|
|
|
|
}
|
|
|
|
|
guard let imageUrlString = decodeHTMLEntities(inString: rawImageUrlString)?.ows_stripped() else {
|
|
|
|
|