Skip to content

Address issues raised by ESLint #2624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/gui/src/electron/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import {
import fs from 'fs';
import path from 'path';
import url from 'url';
import sanitizeFilename from 'sanitize-filename';

import { initialize, enable } from '@electron/remote/main';
import axios from 'axios';
import windowStateKeeper from 'electron-window-state';
import React from 'react';
// import os from 'os';
import ReactDOMServer from 'react-dom/server';
import sanitizeFilename from 'sanitize-filename';
import { ServerStyleSheet, StyleSheetManager } from 'styled-components';
import isURL from 'validator/es/lib/isURL';

Expand All @@ -32,7 +32,6 @@ import AppIcon from '../assets/img/chia64x64.png';
import About from '../components/about/About';
import { i18n } from '../config/locales';
import chiaEnvironment, { chiaInit } from '../util/chiaEnvironment';
import downloadFile from './utils/downloadFile';
import loadConfig, { checkConfigFileExists } from '../util/loadConfig';
import manageDaemonLifetime from '../util/manageDaemonLifetime';
import { setUserDataDir } from '../util/userData';
Expand All @@ -41,6 +40,7 @@ import CacheManager from './CacheManager';
import { readAddressBook, saveAddressBook } from './addressBook';
import installDevTools from './installDevTools.dev';
import { readPrefs, savePrefs, migratePrefs } from './prefs';
import downloadFile from './utils/downloadFile';

/**
* Open the given external protocol URL in the desktop's default manner.
Expand Down Expand Up @@ -332,6 +332,7 @@ if (ensureSingleInstance() && ensureCorrectEnvironment()) {

for (let i = 0; i < tasks.length; i++) {
const { url: downloadUrl, filename } = tasks[i];
const curMainWindow = mainWindow;

try {
const sanitizedFilename = sanitizeFilename(filename);
Expand All @@ -345,7 +346,7 @@ if (ensureSingleInstance() && ensureCorrectEnvironment()) {

await downloadFile(downloadUrl, filePath, {
onProgress: (progress) => {
mainWindow?.webContents.send('multipleDownloadProgress', {
curMainWindow?.webContents.send('multipleDownloadProgress', {
progress,
url: downloadUrl,
index: i,
Expand All @@ -362,7 +363,7 @@ if (ensureSingleInstance() && ensureCorrectEnvironment()) {
if (e.message === 'download aborted' && abortDownloadingFiles) {
break;
}
mainWindow?.webContents.send('errorDownloadingUrl', downloadUrl);
curMainWindow?.webContents.send('errorDownloadingUrl', downloadUrl);
errorFileCount++;
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/gui/src/electron/utils/downloadFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { promises as fs, createWriteStream, type WriteStream } from 'fs';
import debug from 'debug';

import type Headers from '../../@types/Headers';

import fileExists from './fileExists';

const log = debug('chia-gui:downloadFile');
Expand Down