Skip to content

Commit

Permalink
Fix server crash on iOS requests
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldmannak committed Feb 7, 2024
1 parent 229a2bb commit c8dc729
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Sources/App/Middleware/AppStoreAuthenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct AppStoreAuthenticator: HBAsyncAuthenticator {
// (in the iOS and macOS client app: Bundle.main.appStoreReceiptURL)
// However, the receipt is not available when testing in Xcode Sandbox,
// so the server accepts a transaction Id in sandbox mode as well
let request = try await request.collateBody().get()
guard let buffer = request.body.buffer, let body = buffer.getString(at: buffer.readerIndex, length: buffer.readableBytes) else {
request.logger.error("/appstore invoked without app store receipt or transaction id in body")
throw HBHTTPError(.badRequest)
Expand Down

0 comments on commit c8dc729

Please sign in to comment.