Skip to content

Commit

Permalink
Decode the new linkable paths format.
Browse files Browse the repository at this point in the history
  • Loading branch information
daveverwer committed Jul 4, 2023
1 parent 6901306 commit f6ee495
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Sources/App/Controllers/PackageController+routes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,10 @@ enum PackageController {
reference: reference, fragment: .linkablePaths, path: "")
guard let body = awsResponse.body else { return [] }

struct LinkableEntity: Decodable {
var path: String
}

let baseUrl = SiteURL.package(.value(owner), .value(repository), .none).absoluteURL()
return try JSONDecoder()
.decode([LinkableEntity].self, from: body)
.map { "\(baseUrl)/\(reference)\($0.path)" }
.decode([String].self, from: body)
.map { "\(baseUrl)/\(reference)\($0)" }
} catch {
// Errors here should *never* break the site map. Instead, they should return no
// linkable paths. The most likely cause of an error here is either a 4xx from
Expand Down

0 comments on commit f6ee495

Please sign in to comment.