Skip to content

Commit

Permalink
fix: support additional tiles (closes #1947)
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Jun 17, 2024
1 parent 6b2c23c commit 2361590
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,7 @@ export class CADSettingsLiveMapController {
permissions: [Permissions.ManageCADSettings],
})
async updateLiveMapTiles(@MultipartFile("tiles") files: PlatformMulterFile[]) {
const allowedNames = [
"minimap_sea_0_0",
"minimap_sea_0_1",
"minimap_sea_1_0",
"minimap_sea_1_1",
"minimap_sea_2_0",
"minimap_sea_2_1",
];
const allowedName = /minimap_sea_-?\d*(\.\d+)?_-?\d*(\.\d+)?/;

if (!Array.isArray(files)) {
throw new ExtendedBadRequest({ tiles: "Invalid files" });
Expand All @@ -90,7 +83,7 @@ export class CADSettingsLiveMapController {
throw new ExtendedBadRequest({ tiles: "Invalid file type" });
}

if (!allowedNames.includes(file.originalname)) {
if (!allowedName.test(file.originalname)) {
throw new ExtendedBadRequest({ tiles: "Invalid file name" });
}

Expand Down

0 comments on commit 2361590

Please sign in to comment.