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

Commit 6c85b4e

Browse files
committed
fix: updated header and end request handling
1 parent 24fb89f commit 6c85b4e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/http/api/routes/files.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ module.exports = (server) => {
116116
handler: (request, reply) => {
117117
console.log('received')
118118
console.log(request.headers['content-range'])
119-
console.log(request.headers['ipfs-chunk-id'])
120-
console.log(request.headers['ipfs-chunk-name'])
121-
const boundary = request.headers['ipfs-chunk-boundary']
122-
const id = request.headers['ipfs-chunk-name'] // change name to id
123-
const index = Number(request.headers['ipfs-chunk-id'])
119+
console.log(request.headers['x-ipfs-chunk-index'])
120+
console.log(request.headers['x-ipfs-chunk-group-uuid'])
121+
const boundary = request.headers['x-ipfs-chunk-boundary']
122+
const id = request.headers['x-ipfs-chunk-group-uuid'] // change name to id
123+
const index = Number(request.headers['x-ipfs-chunk-index'])
124124
const file = path.join(filesDir, id)
125125
const match = request.headers['content-range'].match(/(\d+)-(\d+)\/(\d+|\*)/)
126126
const ipfs = request.server.app.ipfs
@@ -160,7 +160,7 @@ module.exports = (server) => {
160160
// return;
161161
}
162162

163-
if (index === -1) {
163+
if (start === total) {
164164
// check if size + payload.length === total
165165
/* all chunks have been received */
166166
stream.on('finish', function () {

src/http/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function HttpApi (repo, config, cliArgs) {
105105
routes: {
106106
cors: {
107107
origin: ['*'],
108-
additionalHeaders: ['X-Stream-Output, X-Chunked-Output, X-Content-Length', 'Content-Type', 'Content-Range', 'IPFS-CHUNK-NAME', 'IPFS-CHUNK-ID', 'ipfs-chunk-boundary'],
108+
additionalHeaders: ['X-Stream-Output, X-Chunked-Output, X-Content-Length', 'Content-Type', 'Content-Range', 'x-ipfs-chunk-index', 'x-ipfs-chunk-group-uuid', 'x-ipfs-chunk-boundary'],
109109
additionalExposedHeaders: ['X-Stream-Output, X-Chunked-Output, X-Content-Length']
110110
}
111111
}

0 commit comments

Comments
 (0)