Skip to content

Commit d1287ae

Browse files
author
Fitz
committed
bugfix: 修复content缺少bug
1 parent d60b8f5 commit d1287ae

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/utils/util.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,19 @@ export function sourcesValidate(sources: Array<SourceConfig>): Array<string> {
267267
errmsgs.push(`sources's NO.${index} item verify fail,Pleas fill in sources's type with ${SOURCE_TYPES.join("|")}`);
268268
}
269269

270-
const content = i.content;
271-
const indexOf = content.indexOf("//");
272-
if (indexOf + 1 == content.length -1) {
270+
let content = i.content;
271+
if (_.isEmpty(content)) {
273272
errmsgs.push(`sources's NO.${index} item verify fail,sources's content is required!`);
274-
275273
}
276-
i.content = content.substring(indexOf + 2);
277-
274+
const indexOf = content.indexOf("//");
275+
// 去掉协议
276+
if (indexOf != -1) {
277+
console.log(111)
278+
i.content = content = content.substring(indexOf + 2);
279+
if (_.isEmpty(content)) {
280+
errmsgs.push(`sources's NO.${index} item verify fail,sources's content is required!`);
281+
}
282+
}
278283
const sourcePort = i.port;
279284
if (sourcePort && !(typeof sourcePort == 'number')) {
280285
errmsgs.push(`sources's NO.${index} item verify fail,sources's port expected is number!`);

0 commit comments

Comments
 (0)