fix: (regression beta) couldn't upload on linux when min-disk-space is enabled #664
Massimo Melina committed
Jul 2, 2024 at 10:40 UTC
f3d66ae6b4bb1ce46a8d58fd40600fdfda501672
1 file changed
+3
-4
src/util-os.ts
+3
-4
@@ -37,8 +37,6 @@ export async function getDiskSpaces(): Promise<{ name: string, free: number, tot
37
return onlyTruthy(await Promise.all(drives.map(getDiskSpace)))
38
}
39
return parseDfResult(await promisify(exec)(`df -k`, { timeout: DF_TIMEOUT }).then(x => x.stdout, e => e))
40
- .filter(x => !/^\/(dev|System)\b/.test(x.name))
41
-
40
}
41
42
function parseDfResult(result: string | Error) {
@@ -52,8 +50,9 @@ function parseDfResult(result: string | Error) {
50
return onlyTruthy(out.map(one => {
51
const bits = one.split(/\s+/)
52
if (bits[0] === 'tempfs') return
55
- const name = bits.pop() || bits.shift() || ''
56
- const [, used=0, free=0] = bits.map(x => Number(x) * 1024)
53
+ const name = bits.pop() || ''
54
+ if (/^\/(dev|sys|run|System\/Volumes\/(VM|Preboot|Update|xarts|iSCPreboot|Hardware))\b/.test(name)) return
55
+ const [used=0, free=0] = bits.map(x => Number(x) * 1024).slice(2)
56
const total = used + free
57
return total && { free, total, name }
58
}))