Skip to content

Commit

Permalink
set attachment hash protobuf to bytes, convert in encode/decode
Browse files Browse the repository at this point in the history
  • Loading branch information
sethvincent committed Sep 6, 2023
1 parent e9a2147 commit 1021818
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion proto/observation/v5.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ message Observation_5 {
bytes driveId = 1;
string name = 2;
AttachmentType type = 3;
string hash = 4;
bytes hash = 4;
}
repeated Attachment attachments = 8;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/decode-conversions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const convertObservation: ConvertFunction<'observation'> = (
...rest,
refs: message.refs?.map(({ id }) => ({ id: id.toString('hex') })),
attachments: message.attachments?.map(({ driveId, name, type, hash }) => {
return { driveId: driveId.toString('hex'), name, type, hash }
return { driveId: driveId.toString('hex'), name, type, hash: hash.toString('hex') }
}),
tags: convertTags(message.tags),
metadata: message.metadata || {},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/encode-converstions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const convertObservation: ConvertFunction<'observation'> = (
driveId: Buffer.from(attachment.driveId, 'hex'),
name: attachment.name,
type: attachment.type,
hash: attachment.hash,
hash: Buffer.from(attachment.hash, 'hex'),
}
})

Expand Down

0 comments on commit 1021818

Please sign in to comment.