Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit c22c6eb

Browse files
Merge pull request #138 from web3-storage/fix/fix-split-uploads
fix: Fix issue with chunked uploads invalid origin.
2 parents 41fba67 + 1644ca1 commit c22c6eb

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/commands/car/generate.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import toIterator from 'stream-to-it'
1414
/**
1515
* @typedef {object} GenerateCar
1616
* @property {string} [filePath='']
17-
* @property {boolean} [split=false]
1817
* @typedef {import('yargs').Arguments<GenerateCar>} GenerateCarArgs
1918
*/
2019

@@ -35,7 +34,7 @@ export const writeFileLocally = async (car, outPath = 'output.car') => {
3534
* @param {GenerateCarArgs} argv
3635
* @returns {Promise<void>}
3736
*/
38-
const handler = async ({ filePath = '', split = false }) => {
37+
const handler = async ({ filePath = '' }) => {
3938
const resolvedPath = path.normalize(filePath)
4039

4140
/** @type import('ora').Options */
@@ -46,7 +45,7 @@ const handler = async ({ filePath = '', split = false }) => {
4645
const view = ora(oraOpts).start()
4746

4847
try {
49-
const { stream } = await buildCar(resolvedPath, MAX_CAR_SIZE, !split)
48+
const { stream } = await buildCar(resolvedPath, MAX_CAR_SIZE, false)
5049
/** @type Array<CID> */
5150
let roots = []
5251
/** @type CID */

src/commands/upload.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import path from 'path'
1212
import toIterator from 'stream-to-it'
1313

1414
/**
15-
* @typedef {{path?: string, split?: boolean, profile?: string}} Upload
15+
* @typedef {{path?: string, profile?: string}} Upload
1616
* @typedef {import('yargs').Arguments<Upload>} UploadArgs
1717
*/
1818

@@ -40,7 +40,8 @@ async function generateCarUploads (filePath, view, chunkSize = 512, profile) {
4040
const cid = await bytesToCarCID(car.bytes)
4141
cids.push(cid)
4242

43-
const result = await client.upload(car.bytes, origin?.toString())
43+
// @ts-expect-error
44+
const result = await client.upload(car.bytes, origin)
4445
if (result.error) {
4546
// @ts-expect-error
4647
throw new Error(result?.cause?.message)
@@ -112,13 +113,6 @@ const builder = (yargs) =>
112113
.option('chunk-size', {
113114
type: 'number'
114115
})
115-
.option('split', {
116-
type: 'boolean',
117-
alias: 'split',
118-
showInHelp: true,
119-
describe:
120-
'Split the data into multiple when cars when size limit is hit.'
121-
})
122116

123117
export default {
124118
// command: ['upload <path>', 'import <path>'],

0 commit comments

Comments
 (0)