Skip to content

Commit d0adcd3

Browse files
committed
fix: ensure proper script metadata
1 parent f424b15 commit d0adcd3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/utils/parser/FileParser.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ export default class FileParser {
1010
}
1111

1212
parseData(data) {
13-
if (typeof data === 'string' && data.includes('// ==UserScript==')) {
13+
if (
14+
typeof data === 'string' &&
15+
data.includes('// ==UserScript==') &&
16+
data.includes('// ==/UserScript==')
17+
) {
1418
return extractMeta(data);
1519
}
1620
return data;
@@ -31,6 +35,7 @@ export default class FileParser {
3135

3236
async getVersion(data = this.getUpdateData()) {
3337
const resolvedData = await Promise.resolve(data);
38+
if (!resolvedData) throw new Error('File not found', this.#updateURL);
3439
const version = this.parseVersion(resolvedData);
3540
if (!version || typeof version !== 'string') throw new Error('Version not found');
3641
return version;

0 commit comments

Comments
 (0)