shogun-relay-sdk 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,12 +66,17 @@ class IpfsModule {
66
66
  * @returns Promise with file content as Buffer
67
67
  */
68
68
  async catFromDirectory(directoryCid, filePath) {
69
+ // IPFS API supports paths like CID/path/to/file
70
+ // We need to encode the CID but keep slashes for path navigation
71
+ // Format: /api/v0/cat?arg=QmDirectory/index.html
69
72
  const fullPath = `${directoryCid}/${filePath}`;
70
- return this.client.post(`/api/v1/ipfs/api/v0/cat?arg=${encodeURIComponent(fullPath)}`, null, {
73
+ // Encode only the CID part, keep slashes for navigation
74
+ const encodedPath = fullPath.includes('/')
75
+ ? `${encodeURIComponent(directoryCid)}/${filePath.split('/').map(p => encodeURIComponent(p)).join('/')}`
76
+ : encodeURIComponent(fullPath);
77
+ return this.client.post(`/api/v1/ipfs/api/v0/cat?arg=${encodedPath}`, null, {
71
78
  responseType: "arraybuffer",
72
- headers: {
73
- "Content-Length": "0",
74
- },
79
+ // Don't set Content-Length header - browser will block it
75
80
  });
76
81
  }
77
82
  async pinAdd(cid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shogun-relay-sdk",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "SDK for interacting with Shogun Relay API - HTTP client for IPFS, deals, registry, and network operations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",