fix: (regression 0.57.10) couldn't install new plugins

Massimo Melina committed Aug 12, 2025 at 22:07 UTC 0ed9b50efc37a3c3989eeb1c80bd50ba2f6f5751
1 file changed +3 -2
src/github.ts
+3 -2
@@ -15,7 +15,7 @@ import {
15 HFS_REPO, HTTP_BAD_REQUEST, HTTP_CONFLICT, HTTP_FORBIDDEN, HTTP_NOT_ACCEPTABLE, HTTP_SERVER_ERROR, VERSION,
16 RUNNING_BETA,
17 } from './const'
18 -import { access, readFile, rename, rm, writeFile } from 'fs/promises'
18 +import { access, mkdir, rmdir, readFile, rename, rm, writeFile } from 'fs/promises'
19 import { join } from 'path'
20 import fs from 'fs'
21 import { storedMap } from './persistence'
@@ -82,7 +82,8 @@ export async function downloadPlugin(repo: Repo, { branch='', overwrite=false }=
82
83 async function go(url: string, folder: string, zipRoot: string) {
84 const installPath = PLUGINS_PATH + '/' + folder
85 - await access(installPath, fs.constants.W_OK) // early check for permission
85 + await access(installPath, fs.constants.W_OK) // early check for permission: access if it exists, mkdir if it doesn't
86 + .catch(() => mkdir(installPath, { recursive: true }).then(() => rmdir(installPath)))
87 const tempInstallPath = installPath + '-installing' + DISABLING_SUFFIX
88 const foldersToCopy = [ // from longer to shorter, so we first test the longer
89 zipRoot + '-' + process.platform + '-' + process.arch,