Skip to content

Commit

Permalink
fix(client): accept 16 byte achievement IDs instead of 20 byte
Browse files Browse the repository at this point in the history
  • Loading branch information
DASPRiD committed Jan 24, 2024
1 parent c3d86d5 commit 884637e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const handleClient = async (
}

case Command.getAudio: {
const id = (await stream.readExact(20));
const id = (await stream.readExact(16));
const result = await processor.getAudio(id);

if (result instanceof AudioNotFoundResult) {
Expand Down
6 changes: 3 additions & 3 deletions test/get-audio.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('GetAudio', () => {
getAudio: async () => Promise.resolve(new AudioNotFoundResult()),
}, async stream => {
stream.writeUint8(Command.getAudio);
stream.writeAll(Buffer.from('0'.repeat(40), 'hex'));
stream.writeAll(Buffer.from('0'.repeat(32), 'hex'));

const response = await stream.readUint8();
expect(response).toBe(GetAudioResponse.audioNotFound);
Expand All @@ -25,7 +25,7 @@ describe('GetAudio', () => {
},
}, async stream => {
stream.writeUint8(Command.getAudio);
stream.writeAll(Buffer.from('0'.repeat(40), 'hex'));
stream.writeAll(Buffer.from('0'.repeat(32), 'hex'));

const response = await stream.readUint8();
expect(response).toBe(GetAudioResponse.audioFound);
Expand All @@ -37,6 +37,6 @@ describe('GetAudio', () => {
expect(data).toEqual(Buffer.from('foobar', 'ascii'));
});

expect(result).toEqual({id: Buffer.from('0'.repeat(40), 'hex')});
expect(result).toEqual({id: Buffer.from('0'.repeat(32), 'hex')});
});
});

0 comments on commit 884637e

Please sign in to comment.