Skip to content

Commit

Permalink
feat: Sanitize paths in beatmap states.
Browse files Browse the repository at this point in the history
  • Loading branch information
GabuTheDev committed Feb 1, 2025
1 parent 73ec0ff commit 9b07ac1
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions packages/tosu/src/states/beatmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ import { ClientType, config, wLogger } from '@tosu/common';
import fs from 'fs';
import { Beatmap as ParsedBeatmap, TimingPoint } from 'osu-classes';
import { BeatmapDecoder } from 'osu-parsers';
import path from 'path';

import { BeatmapStrains } from '@/api/types/v1';
import { AbstractInstance } from '@/instances';
import { AbstractState } from '@/states';
import { fixDecimals } from '@/utils/converters';
import { cleanPath, fixDecimals } from '@/utils/converters';
import { removeDebuffMods } from '@/utils/osuMods';
import { CalculateMods, ModsLazer } from '@/utils/osuMods.types';

Expand Down Expand Up @@ -316,9 +315,9 @@ export class BeatmapPP extends AbstractState {
`beatmapPP updateMapMetadata`,
`Skip osu! music theme file`,
{
SongsFolder: global.songsFolder,
Folder: menu.folder,
Path: menu.filename
SongsFolder: cleanPath(global.songsFolder),
Folder: cleanPath(menu.folder),
Path: cleanPath(menu.filename)
}
);
return;
Expand All @@ -331,18 +330,18 @@ export class BeatmapPP extends AbstractState {
`beatmapPP updateMapMetadata`,
`Skip new map creation`,
{
SongsFolder: global.songsFolder,
Folder: menu.folder,
Path: menu.filename
SongsFolder: cleanPath(global.songsFolder),
Folder: cleanPath(menu.folder),
Path: cleanPath(menu.filename)
}
);
return;
}

const mapPath = path.join(
global.songsFolder.trim(),
menu.folder.trim(),
menu.filename.trim()
const mapPath = cleanPath(
global.songsFolder,
menu.folder,
menu.filename
);

try {
Expand Down

0 comments on commit 9b07ac1

Please sign in to comment.