mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-24 06:48:10 +00:00
Safer HTML String decode
This commit is contained in:
parent
523cb48cd1
commit
87471ed9c8
1 changed files with 7 additions and 3 deletions
|
@ -10,9 +10,13 @@ public struct HTMLString: Decodable, Equatable {
|
||||||
public let statusesURLs: [URL]
|
public let statusesURLs: [URL]
|
||||||
public let asSafeMarkdownAttributedString: AttributedString
|
public let asSafeMarkdownAttributedString: AttributedString
|
||||||
|
|
||||||
public init(from decoder: Decoder) throws {
|
public init(from decoder: Decoder) {
|
||||||
let container = try decoder.singleValueContainer()
|
do {
|
||||||
htmlValue = try container.decode(String.self)
|
let container = try decoder.singleValueContainer()
|
||||||
|
htmlValue = try container.decode(String.self)
|
||||||
|
} catch {
|
||||||
|
htmlValue = ""
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
asMarkdown = try HTMLParser().parse(html: htmlValue)
|
asMarkdown = try HTMLParser().parse(html: htmlValue)
|
||||||
|
|
Loading…
Reference in a new issue