Skip to content

Commit edb77a6

Browse files
committed
fix: damn regexes
1 parent e517c41 commit edb77a6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/github.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -447,14 +447,14 @@ class Github {
447447
needsUpdate = true;
448448
return '-e file:.';
449449
}
450-
if (line.trim().startsWith('# -r ')) {
451-
// Replace everything before 'requirements/' with '# -r requirements/'
452-
const fixedLine = line.replace(/#\s+-r\s+\S*requirements\//, '# -r requirements/');
453-
454-
if (fixedLine !== line) {
455-
needsUpdate = true;
456-
return fixedLine;
457-
}
450+
if (/^\s*#\s*-r\s+\S*requirements\//.test(line)) {
451+
// Replace everything before 'requirements/' with '# -r requirements/'
452+
const fixedLine = line.replace(/#\s*-r\s+\S*requirements\//, '# -r requirements/');
453+
454+
if (fixedLine !== line) {
455+
needsUpdate = true;
456+
return fixedLine;
457+
}
458458
}
459459
return line;
460460
});

0 commit comments

Comments
 (0)