mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Fix: pound sign handling
This commit is contained in:
@@ -168,7 +168,13 @@ export class FileOutput {
|
||||
}
|
||||
|
||||
private async addFromDomainsetPromise(source: MaybePromise<AsyncIterable<string> | Iterable<string> | string[]>) {
|
||||
for await (const line of await source) {
|
||||
for await (let line of await source) {
|
||||
const otherPoundSign = line.lastIndexOf('#');
|
||||
|
||||
if (otherPoundSign > 0) {
|
||||
line = line.slice(0, otherPoundSign).trimEnd();
|
||||
}
|
||||
|
||||
if (line[0] === '.') {
|
||||
this.addDomainSuffix(line, true);
|
||||
} else {
|
||||
@@ -187,7 +193,13 @@ export class FileOutput {
|
||||
}
|
||||
|
||||
private async addFromRulesetPromise(source: MaybePromise<AsyncIterable<string> | Iterable<string> | string[]>) {
|
||||
for await (const line of await source) {
|
||||
for await (let line of await source) {
|
||||
const otherPoundSign = line.lastIndexOf('#');
|
||||
|
||||
if (otherPoundSign > 0) {
|
||||
line = line.slice(0, otherPoundSign).trimEnd();
|
||||
}
|
||||
|
||||
const splitted = line.split(',');
|
||||
const type = splitted[0];
|
||||
const value = splitted[1];
|
||||
|
||||
Reference in New Issue
Block a user