Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pass url and body to badRequestResponse #44

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/verified-fetch/src/verified-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,17 @@ export class VerifiedFetch {
*/
private async handleIPNSRecord ({ resource, cid, path, options }: FetchHandlerFunctionArg): Promise<Response> {
if (path !== '' || !resource.startsWith('ipns://')) {
return badRequestResponse('Invalid IPNS name')
return badRequestResponse(resource, 'Invalid IPNS name')
}

let peerId: PeerId

try {
peerId = peerIdFromString(resource.replace('ipns://', ''))
} catch (err) {
} catch (err: any) {
this.log.error('could not parse peer id from IPNS url %s', resource)

return badRequestResponse('Invalid IPNS name')
return badRequestResponse(resource, err)
}

// since this call happens after parseResource, we've already resolved the
Expand Down
Loading