fix: fixing sonar issues

This commit is contained in:
Chubby Granny Chaser 2025-01-22 00:19:24 +00:00
parent 71cb4cd240
commit 2aff983dec
No known key found for this signature in database
4 changed files with 7 additions and 8 deletions

View file

@ -30,7 +30,7 @@ const openGameInstaller = async (
const downloadKey = levelKeys.game(shop, objectId);
const download = await downloadsSublevel.get(downloadKey);
if (!download || !download.folderName) return true;
if (!download?.folderName) return true;
const gamePath = path.join(
download.downloadPath ?? (await getDownloadsPath()),

View file

@ -29,8 +29,8 @@ export class DownloadManager {
: undefined,
downloadsToSeed?.map((download) => ({
game_id: `${download.shop}-${download.objectId}`,
url: download.uri!,
save_path: download.downloadPath!,
url: download.uri,
save_path: download.downloadPath,
}))
);
@ -187,7 +187,7 @@ export class DownloadManager {
if (!download) return;
const totalSize = await getDirSize(
path.join(download.downloadPath!, status.folderName)
path.join(download.downloadPath, status.folderName)
);
if (totalSize < status.fileSize) {
@ -223,7 +223,7 @@ export class DownloadManager {
return this.startDownload(download);
}
static async cancelDownload(downloadKey = this.downloadingGameId!) {
static async cancelDownload(downloadKey = this.downloadingGameId) {
await PythonRPC.rpc.post("/action", {
action: "cancel",
game_id: downloadKey,

View file

@ -10,8 +10,7 @@ import icon from "@resources/icon.png?asset";
import { NotificationOptions, toXmlString } from "./xml";
import { logger } from "../logger";
import type { Game, UserPreferences } from "@types";
import { levelKeys } from "@main/level";
import { db } from "@main/level";
import { db, levelKeys } from "@main/level";
async function downloadImage(url: string | null) {
if (!url) return undefined;

View file

@ -67,7 +67,7 @@ export function RepacksModal({
};
const checkIfLastDownloadedOption = (repack: GameRepack) => {
if (!game || !game.download) return false;
if (!game?.download) return false;
return repack.uris.some((uri) => uri.includes(game.download!.uri));
};