File tree 1 file changed +5
-3
lines changed
packages/host/app/components/ai-assistant
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -305,14 +305,16 @@ function extractCodeData(preElementString: string) {
305
305
// We need this url so that we know which file the code patch applies to.
306
306
// We extract this url and remove it from the content.
307
307
let fileUrl = null ;
308
- if (content ?.startsWith (' // File url: ' )) {
309
- let firstLine = content .split (' \n ' )[0 ];
308
+
309
+ let trimmedContent = content ?.trim ();
310
+ if (trimmedContent .trim ().startsWith (' // File url: ' )) {
311
+ let firstLine = trimmedContent .trim ().split (' \n ' )[0 ];
310
312
let fileUrlRegex = / File url: (. * )/ ;
311
313
let fileUrlMatch = firstLine .match (fileUrlRegex );
312
314
if (fileUrlMatch ) {
313
315
fileUrl = fileUrlMatch [1 ];
314
316
}
315
- content = content .slice (firstLine .length ).trimStart ();
317
+ content = trimmedContent .slice (firstLine .length ).trimStart ();
316
318
}
317
319
318
320
return {
You can’t perform that action at this time.
0 commit comments