Fix: pound sign handling

This commit is contained in:
SukkaW 2025-08-18 00:34:28 +08:00
parent bae38ea3a8
commit 8ec28f6260
3 changed files with 14 additions and 10 deletions

View File

@ -88,8 +88,6 @@ export const buildCdnDownloadConf = task(require.main === module, __filename)(as
steamDomainSetPromise
]);
console.log(JSON.stringify(cdnDomainsList, null, 2));
// Move S3 domains to download domain set, since S3 files may be large
appendArrayInPlace(downloadDomainSet, S3OSSDomains);
appendArrayInPlace(downloadDomainSet, steamDomainSet);

View File

@ -37,12 +37,6 @@ export function processLine(line: string): string | null {
*/
}
const otherPoundSign = trimmed.indexOf('#');
if (otherPoundSign > 0) {
return trimmed.slice(0, otherPoundSign).trimEnd();
}
return trimmed;
}

View File

@ -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];