Commit 30f4c110 authored by nanahira's avatar nanahira

fix upload ydk

parent aeae1e7f
Pipeline #37879 passed with stages
in 4 minutes and 42 seconds
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
"class-transformer": "^0.5.1", "class-transformer": "^0.5.1",
"class-validator": "^0.14.1", "class-validator": "^0.14.1",
"crypto-random-string": "3.3.1", "crypto-random-string": "3.3.1",
"iconv-lite": "^0.6.3",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"nesties": "^1.1.1", "nesties": "^1.1.1",
"nestjs-mycard": "^4.0.2", "nestjs-mycard": "^4.0.2",
......
import { Participant } from '../participant/entities/participant.entity'; import { Participant } from '../participant/entities/participant.entity';
import YGOProDeck from 'ygopro-deck-encode'; import YGOProDeck from 'ygopro-deck-encode';
import iconv from 'iconv-lite';
export const multerToParticipant = ( export const multerToParticipant = (
multerFile: Express.Multer.File, multerFile: Express.Multer.File,
...@@ -8,7 +9,8 @@ export const multerToParticipant = ( ...@@ -8,7 +9,8 @@ export const multerToParticipant = (
const participant = new Participant(); const participant = new Participant();
participant.quit = false; participant.quit = false;
participant.seq = 1000; participant.seq = 1000;
participant.name = multerFile.originalname.replace(/(\.ydk)+$/i, ''); const rawName = iconv.decode(Buffer.from(multerFile.originalname, 'binary'), 'utf-8');
participant.name = rawName.replace(/(\.ydk)+$/i, '');
participant.tournamentId = tournamentId; participant.tournamentId = tournamentId;
participant.deckbuf = Buffer.from( participant.deckbuf = Buffer.from(
YGOProDeck.fromYdkString( YGOProDeck.fromYdkString(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment