Skip to content

Commit

Permalink
🐛 Fix migration url
Browse files Browse the repository at this point in the history
  • Loading branch information
Xen0Xys committed May 22, 2024
1 parent 1457ff7 commit 806dcb1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/modules/webtoon/migration/migration.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ export class MigrationService{

async migrateFrom(url: string, adminKey: string){
// Get migration infos using axios from the url
const response = await axios.get(url, {
const response = await axios.get(url + "/api/v1/migration/infos", {
headers: {
"Authorization": adminKey
}
});

Check failure

Code scanning / CodeQL

Server-side request forgery Critical

The
URL
of this request depends on a
user-provided value
.
const migrationInfos: MigrationInfosResponse = response.data;
// Migrate the data
for(let i = 1; i <= migrationInfos.chunkNumber; i++){
const imageZipBuffer: Buffer = await this.downloadFile(`${url}/images?chunk=${i}`, adminKey);
const imageZipBuffer: Buffer = await this.downloadFile(`${url}/api/v1/migration/images?chunk=${i}`, adminKey);
const imageZip: JSZip = await JSZip.loadAsync(imageZipBuffer);
const images: Record<string, Buffer> = {};
for(const [fileName, file] of Object.entries(imageZip.files))
Expand All @@ -35,7 +35,7 @@ export class MigrationService{
}
// Database migration
await this.prismaService.onModuleDestroy();
const databaseBuffer: Buffer = await this.downloadFile(`${url}/database`, adminKey);
const databaseBuffer: Buffer = await this.downloadFile(`${url}/api/v1/migration/database`, adminKey);
fs.writeFileSync("./prisma/database.db", databaseBuffer);
await this.prismaService.onModuleInit();
}
Expand Down

0 comments on commit 806dcb1

Please sign in to comment.