Skip to content

Commit

Permalink
fix: assert relatedAttachments are present
Browse files Browse the repository at this point in the history
  • Loading branch information
benedikt-schaber committed Jan 27, 2023
1 parent 03472cc commit 5b2b57d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/basic/encode/related.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { encodeAttachment } from "./attachment.ts";
type writer = (...args: string[]) => Promise<void>;

export function encodeRelated(writeCMD: writer, content: Content) {
if (!content.relatedAttachments) {
throw new Error("Content does not contain relatedAttachments. Cannot encode as related.");
}

const boundaryAddRel = calcBoundary(
content.content + "\n"
+ content.relatedAttachments.map(v => v.content).join("\n"),
Expand Down

0 comments on commit 5b2b57d

Please sign in to comment.