We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fedadf6 commit 7c34a23Copy full SHA for 7c34a23
1 file changed
.github/validator/url.js
@@ -3,6 +3,16 @@ import path from 'path';
3
import { json } from 'stream/consumers';
4
5
export function url(inputUrl) {
6
+ if (!inputUrl) {
7
+ throw new Error('请输入 URL');
8
+ }
9
+ if (/\.(edu|vpn)(\/|\.|$)/.test(inputUrl)) {
10
+ throw new Error('请勿提交机构代理的 URL');
11
12
+ if (/\.cnki\./.test(inputUrl)) {
13
+ throw new Error('该 url 已通过 CNKI.js 适配。');
14
15
+
16
const rootDir = path.resolve(__dirname, '../../..');
17
const files = fs.readdirSync(rootDir).filter(f => f.endsWith('.js'));
18
let matched = false;
@@ -18,7 +28,8 @@ export function url(inputUrl) {
28
matched = true;
19
29
}
20
30
} catch (e) {
21
- // 忽略解析错误
31
+ console.error(`Error parsing JSON in ${file}:`, e);
32
+ continue;
22
33
23
34
24
35
if (matched) {
0 commit comments