Skip to content

Commit

Permalink
fix: 无法识别外部资源的 EOL
Browse files Browse the repository at this point in the history
  • Loading branch information
geekdada committed Apr 24, 2020
1 parent bb43dc7 commit bee0c12
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/utils/remote-snippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ import got from 'got';
import Bluebird from 'bluebird';
import crypto from 'crypto';
import { logger } from '@surgio/logger';
import detectNewline from 'detect-newline';

import { RemoteSnippet, RemoteSnippetConfig } from '../types';
import { NETWORK_CONCURRENCY, NETWORK_TIMEOUT, REMOTE_SNIPPET_CACHE_MAXAGE } from './constant';
import { ConfigCache } from './cache';
import { createTmpFactory } from './tmp-helper';

export const addProxyToSurgeRuleSet = (str: string, proxyName: string): string => {
const eol = detectNewline(str);

return str
.split('\n')
.split(eol || '\n')
.map(item => {
if (item.trim() === '' || item.startsWith('#') || item.startsWith('//')) {
return item;
Expand Down

0 comments on commit bee0c12

Please sign in to comment.