Skip to content

Commit

Permalink
NVBW (EFA): automatically repair response with illegal encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-albers committed Jun 16, 2024
1 parent 2552f22 commit e11bea2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/TripKit/Provider/AbstractEfaWebProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ public class AbstractEfaWebProvider: AbstractEfaProvider {

func _queryTripsParsing(request: HttpRequest, from: Location?, via: Location?, to: Location?, date: Date, departure: Bool, tripOptions: TripOptions, previousContext: QueryTripsContext?, later: Bool, completion: @escaping (HttpRequest, QueryTripsResult) -> Void) throws {
guard let data = request.responseData else { throw ParseError(reason: "no response") }
let xml = XMLHash.parse(data)
let xmlString = String(decoding: data, as: UTF8.self) // automatically repair strings with illegal encoding
let xml = XMLHash.parse(xmlString)
var response = xml["itdRequest"]["itdTripRequest"]
if response.all.isEmpty {
response = xml["itdRequest"]
Expand Down

0 comments on commit e11bea2

Please sign in to comment.