diff --git a/modules/ipfs.js b/modules/ipfs.js index d5e164b..cb7f254 100644 --- a/modules/ipfs.js +++ b/modules/ipfs.js @@ -59,11 +59,14 @@ const pinCid = async (cid) => { console.log(`[IPFS] Trying to fetch CID ${cid.slice(0, 12)}..., using ${peerCount} peers`); // Fire-and-forget: Start pin in background without waiting - const endpoint = `${IPFS_API}/api/v0/pin/add?arg=${encodeURIComponent(cid)}&recursive=true&progress=true`; - - // Start the pin operation but don't await it - axios.post(endpoint, null, { - timeout: 3 * 60 * 60 * 1000 // 3 hours + const endpoint = `${IPFS_API}/api/v0/pin/add?arg=${encodeURIComponent(cid)}&recursive=true`; + + // Start the pin operation but don't await it (cap body size to avoid buffer growth) + axios.post(endpoint, null, { + timeout: 3 * 60 * 60 * 1000, // 3 hours + responseType: "json", + maxContentLength: 1024 * 1024, // 1 MB safety cap + maxBodyLength: 1024 * 1024, }).then((pinResponse) => { if (pinResponse.data && pinResponse.data.Pins) { console.log(`[IPFS-API] PIN_COMPLETED cid=${cid}`); diff --git a/package-lock.json b/package-lock.json index a016ec7..fda4c73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "file-drop", - "version": "1.4.1", + "version": "1.4.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "file-drop", - "version": "1.4.1", + "version": "1.4.2", "license": "ISC", "dependencies": { "axios": "^1.8.4", diff --git a/package.json b/package.json index e838b10..34822af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "file-drop", - "version": "1.4.1", + "version": "1.4.2", "description": "file drop", "main": "app.js", "scripts": {