Skip to content

Commit 884bc73

Browse files
committed
Fix: rarity weight for folders
1 parent 8a41e84 commit 884bc73

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed
-44.4 KB
Binary file not shown.

src/main.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,9 @@ const buildSetup = () => {
6363

6464
const getRarityWeight = (_path) => {
6565
// check if there is an extension, if not, consider it a directory
66-
const exp = /(\d*)/;
67-
// use the delimiter from config
68-
const parts = _path.split(rarityDelimiter);
69-
const weight = exp.exec(parts[parts.length - 1]);
70-
const weightNumber = weight[0] ? Number(weight[0]) : -1;
66+
const exp = new RegExp(`${rarityDelimiter}(\\d*)`, "g");
67+
const weight = exp.exec(_path);
68+
const weightNumber = weight ? Number(weight[1]) : -1;
7169

7270
if (weightNumber < 0 || isNaN(weightNumber)) {
7371
return "required";

0 commit comments

Comments
 (0)