Skip to content

Commit 27df3f8

Browse files
committed
Refactor match handling in resolvePlatformIncludes function
1 parent 233937f commit 27df3f8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/api/llms-txt/[...path]/route.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,10 @@ function resolvePlatformIncludes(
337337
// Replace PlatformContent includes with actual content
338338
const includePattern = /<PlatformContent[^>]*includePath="([^"]*)"[^>]*\/>/g;
339339
let result = content;
340-
let match;
340+
let match = includePattern.exec(content);
341341

342342
// Fix assignment in while condition by using a separate variable
343-
while ((match = includePattern.exec(content)) !== null) {
343+
while (match !== null) {
344344
const includePath = match[1];
345345
const fullMatch = match[0];
346346

@@ -385,6 +385,9 @@ function resolvePlatformIncludes(
385385
`\n*[${sectionName.charAt(0).toUpperCase() + sectionName.slice(1)} instructions would appear here]*\n`
386386
);
387387
}
388+
389+
// Get the next match
390+
match = includePattern.exec(content);
388391
}
389392

390393
return Promise.resolve(result);

0 commit comments

Comments
 (0)