Fix bug where card db would try to load non-images to the database
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Ethan Lane 2023-10-21 17:47:14 +01:00
parent 005a366883
commit 7b73c66a3c
2 changed files with 4 additions and 4 deletions

BIN
cards.db Normal file

Binary file not shown.

View file

@ -59,7 +59,7 @@ export default class CardSetupFunction {
const cardDirLegendary = legendaryExists ? readdirSync(path.join(process.cwd(), 'cards', series.Path, 'LEGENDARY')) : []; const cardDirLegendary = legendaryExists ? readdirSync(path.join(process.cwd(), 'cards', series.Path, 'LEGENDARY')) : [];
const cardDirSilver = silverExists ? readdirSync(path.join(process.cwd(), 'cards', series.Path, 'SILVER')) : []; const cardDirSilver = silverExists ? readdirSync(path.join(process.cwd(), 'cards', series.Path, 'SILVER')) : [];
for (let file of cardDirBronze) { for (let file of cardDirBronze.filter(x => !x.startsWith('.') && (x.endsWith('.png') || x.endsWith('.jpg') || x.endsWith('.gif')))) {
const filePart = file.split('.'); const filePart = file.split('.');
const cardId = filePart[0]; const cardId = filePart[0];
@ -70,7 +70,7 @@ export default class CardSetupFunction {
cardsToSave.push(card); cardsToSave.push(card);
} }
for (let file of cardDirGold) { for (let file of cardDirGold.filter(x => !x.startsWith('.') && (x.endsWith('.png') || x.endsWith('.jpg') || x.endsWith('.gif')))) {
const filePart = file.split('.'); const filePart = file.split('.');
const cardId = filePart[0]; const cardId = filePart[0];
@ -81,7 +81,7 @@ export default class CardSetupFunction {
cardsToSave.push(card); cardsToSave.push(card);
} }
for (let file of cardDirLegendary) { for (let file of cardDirLegendary.filter(x => !x.startsWith('.') && (x.endsWith('.png') || x.endsWith('.jpg') || x.endsWith('.gif')))) {
const filePart = file.split('.'); const filePart = file.split('.');
const cardId = filePart[0]; const cardId = filePart[0];
@ -92,7 +92,7 @@ export default class CardSetupFunction {
cardsToSave.push(card); cardsToSave.push(card);
} }
for (let file of cardDirSilver) { for (let file of cardDirSilver.filter(x => !x.startsWith('.') && (x.endsWith('.png') || x.endsWith('.jpg') || x.endsWith('.gif')))) {
const filePart = file.split('.'); const filePart = file.split('.');
const cardId = filePart[0]; const cardId = filePart[0];