Skip to content

Commit c1f3f40

Browse files
use regex match instead of startsWith
1 parent aa0c86b commit c1f3f40

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/server/cookies.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,10 @@ const getAllChunkedCookies = (
154154
reqCookies: RequestCookies,
155155
name: string
156156
): RequestCookie[] => {
157-
const PREFIX = `${name}${CHUNK_PREFIX}`;
158-
return reqCookies.getAll().filter((cookie) => cookie.name.startsWith(PREFIX));
157+
const chunkedCookieRegex = new RegExp(`^${name}${CHUNK_PREFIX}\\d+$`);
158+
return reqCookies
159+
.getAll()
160+
.filter((cookie) => chunkedCookieRegex.test(cookie.name));
159161
};
160162

161163
/**

0 commit comments

Comments
 (0)