forked from shadowfacts/Tusker
parent
26c483fc9a
commit
54376ac585
|
@ -63,10 +63,14 @@ public struct OptionalURLDecoder: Codable, Sendable, Hashable, ExpressibleByNilL
|
||||||
self.wrappedValue = nil
|
self.wrappedValue = nil
|
||||||
} else {
|
} else {
|
||||||
let s = try container.decode(String.self)
|
let s = try container.decode(String.self)
|
||||||
do {
|
if s.isEmpty {
|
||||||
self.wrappedValue = try parseStrategy.parse(s)
|
self.wrappedValue = nil
|
||||||
} catch {
|
} else {
|
||||||
throw DecodingError.dataCorrupted(.init(codingPath: container.codingPath, debugDescription: "Could not decode URL '\(s)'", underlyingError: error))
|
do {
|
||||||
|
self.wrappedValue = try parseStrategy.parse(s)
|
||||||
|
} catch {
|
||||||
|
throw DecodingError.dataCorrupted(.init(codingPath: container.codingPath, debugDescription: "Could not decode URL '\(s)'", underlyingError: error))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue