diff --git a/src/cli/files-3ds.cmd.ts b/src/cli/files-3ds.cmd.ts index 93d488a..2d9e8bb 100644 --- a/src/cli/files-3ds.cmd.ts +++ b/src/cli/files-3ds.cmd.ts @@ -140,11 +140,12 @@ const createCmd = new Command('create') .option('--attribute3 [attribute3]', 'Attribute 3 for this task file') .option('--desc [desc]', 'Description for this task file') .option('-m, --mark-arrived-privileged', 'Only notify of new content to privileged titles') + .option('-n, --no-payload', 'Make this task file have no payload contents') .action(commandHandler<[string, string]>(async (cmd): Promise => { const [appId, taskId] = cmd.args; // TODO - Handle multiple payload contents - const opts = cmd.opts<{ name: string; titleId: string; contentDatatype: string; nsDataId: string; version: string; file: string; country: string[]; lang: string[]; attribute1?: string; attribute2?: string; attribute3?: string; desc?: string; markArrivedPrivileged: boolean }>(); - const fileBuf = await fs.readFile(opts.file); + const opts = cmd.opts<{ name: string; titleId: string; contentDatatype: string; nsDataId: string; version: string; file: string; country: string[]; lang: string[]; attribute1?: string; attribute2?: string; attribute3?: string; desc?: string; markArrivedPrivileged: boolean; payload: boolean }>(); + const fileBuf = opts.payload ? await fs.readFile(opts.file) : Buffer.alloc(0); const ctx = getCliContext(); const { file } = await ctx.grpc.uploadFileCTR({ taskId: taskId, @@ -158,13 +159,15 @@ const createCmd = new Command('create') description: opts.desc }, name: opts.name, - payloadContents: [{ - titleId: BigInt(parseInt(opts.titleId, 16)), - contentDatatype: Number(opts.contentDatatype), - nsDataId: Number(opts.nsDataId), - version: Number(opts.version), - content: fileBuf - }], + payloadContents: opts.payload + ? [{ + titleId: BigInt(parseInt(opts.titleId, 16)), + contentDatatype: Number(opts.contentDatatype), + nsDataId: Number(opts.nsDataId), + version: Number(opts.version), + content: fileBuf + }] + : [], flags: { markArrivedPrivileged: opts.markArrivedPrivileged } diff --git a/src/services/grpc/boss/v2/upload-file-ctr.ts b/src/services/grpc/boss/v2/upload-file-ctr.ts index b787ce6..0cdf8e5 100644 --- a/src/services/grpc/boss/v2/upload-file-ctr.ts +++ b/src/services/grpc/boss/v2/upload-file-ctr.ts @@ -57,10 +57,6 @@ export async function uploadFileCTR(request: UploadFileCTRRequest, context: Call } } - if (payloads.length === 0) { - throw new ServerError(Status.INVALID_ARGUMENT, 'Cannot upload empty file'); - } - if (!request.attributes) { request.attributes = { attribute1: '',