Skip to content

Commit 2dc65ec

Browse files
authored
[Fix] Skip symlinks during size calculation (#3570)
Skip symlinks during size calculation
1 parent a891fcf commit 2dc65ec

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/backend/utils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ import {
7575
updateWineVersionInfos,
7676
wineDownloaderInfoStore
7777
} from './wine/manager/utils'
78-
import { readdir, stat } from 'fs/promises'
78+
import { readdir, lstat } from 'fs/promises'
7979
import { getHeroicVersion } from './utils/systeminfo/heroicVersion'
8080
import { backendEvents } from './backend_events'
8181
import { wikiGameInfoStore } from './wiki_game_info/electronStore'
@@ -1188,8 +1188,11 @@ function removeFolder(path: string, folderName: string) {
11881188
}
11891189

11901190
async function getPathDiskSize(path: string): Promise<number> {
1191-
const statData = await stat(path)
1191+
const statData = await lstat(path)
11921192
let size = 0
1193+
if (statData.isSymbolicLink()) {
1194+
return 0
1195+
}
11931196
if (statData.isDirectory()) {
11941197
const contents = await readdir(path)
11951198

0 commit comments

Comments
 (0)