mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-15 23:42:27 +08:00
fix(connections): accept empty rule extensions
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { dump, load } from 'js-yaml'
|
||||
import { dump, loadAll } from 'js-yaml'
|
||||
import isFQDN from 'validator/es/lib/isFQDN'
|
||||
import isIP from 'validator/es/lib/isIP'
|
||||
|
||||
@@ -65,7 +65,11 @@ export async function getConnectionRootDomain(host: string) {
|
||||
}
|
||||
|
||||
function parseRuleExtension(content: string) {
|
||||
const parsed: unknown = load(content)
|
||||
const documents = loadAll(content)
|
||||
if (documents.length > 1) {
|
||||
throw new Error('The rule extension must contain a single YAML document.')
|
||||
}
|
||||
const parsed = documents[0]
|
||||
if (
|
||||
parsed !== undefined &&
|
||||
parsed !== null &&
|
||||
|
||||
Reference in New Issue
Block a user