Skip to content

Commit fc4fccd

Browse files
jspenguin2017gorhill
authored andcommitted
Accept # Title: and # Expires:; optimize RegExp (gorhill#3679)
* Accept `# Title:` and `# Expires`; optimize RegExp * Prevent confusion with network filter
1 parent 79b4706 commit fc4fccd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/js/storage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@
733733
// https://github.com/gorhill/uBlock/issues/313
734734
// Always try to fetch the name if this is an external filter list.
735735
if ( listEntry.title === '' || listEntry.group === 'custom' ) {
736-
matches = head.match(/(?:^|\n)!\s*Title:([^\n]+)/i);
736+
matches = head.match(/(?:^|\n)(?:!|# )\s*Title:([^\n]+)/i);
737737
if ( matches !== null ) {
738738
// https://bugs.chromium.org/p/v8/issues/detail?id=2869
739739
// JSON.stringify/JSON.parse is to work around String.slice()
@@ -743,7 +743,7 @@
743743
}
744744
}
745745
// Extract update frequency information
746-
matches = head.match(/(?:^|\n)![\t ]*Expires:[\t ]*([\d]+)[\t ]*days?/i);
746+
matches = head.match(/(?:^|\n)(?:!|# )[\t ]*Expires:[\t ]*(\d+)[\t ]*day/i);
747747
if ( matches !== null ) {
748748
v = Math.max(parseInt(matches[1], 10), 1);
749749
if ( v !== listEntry.updateAfter ) {

0 commit comments

Comments
 (0)