Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

fix(pubsub): multibase in pubsub http rpc #3922

Merged
merged 15 commits into from
Dec 15, 2021
Merged
Prev Previous commit
Next Next commit
fix: regression in /api/v0/files/rm
This works around ipfs/kubo#8606
  • Loading branch information
lidel committed Dec 14, 2021
commit cad816defcb70adcc1fc2a75e8de9ca0b567bcae
11 changes: 10 additions & 1 deletion packages/ipfs-http-client/src/files/rm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { configure } from '../lib/configure.js'
import { toUrlSearchParams } from '../lib/to-url-search-params.js'
import HTTP from 'ipfs-utils/src/http.js'

/**
* @typedef {import('../types').HTTPClientExtraOptions} HTTPClientExtraOptions
Expand All @@ -20,7 +21,15 @@ export const createRm = configure(api => {
headers: options.headers
})

await res.text()
const body = await res.text()
// we don't expect text body to be ever present
// (if so, it means an error such as https://github.com/ipfs/go-ipfs/issues/8606)
if (body !== '') {
/** @type {Error} */
const error = new HTTP.HTTPError(res)
error.message = body
throw error
}
Comment on lines +24 to +32
Copy link
Member Author

@lidel lidel Dec 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@achingbrain would this work around be acceptable here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:groan:

}
return rm
})