Skip to content

Commit 728c5e7

Browse files
committed
also validate multipart boundary when changed
1 parent 4f53dad commit 728c5e7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Multipart.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ export class Multipart implements Part {
120120

121121
public set boundary(boundary: Uint8Array | string) {
122122
this.#boundary = typeof boundary === "string" ? new TextEncoder().encode(boundary) : boundary;
123+
if (!Multipart.isValidBoundary(this.#boundary))
124+
throw new RangeError("Boundary must be 1 to 70 characters long, not end with space, and may only contain: A-Z a-z 0-9 '()+_,-./:=? and space");
123125
this.setHeaders();
124126
}
125127

0 commit comments

Comments
 (0)