fix: (regression beta) admin/plugins/search: error installing

Massimo Melina committed Apr 22, 2025 at 00:15 UTC 5683d9d357ea06991d0f258d4b896133f8a5b939
1 file changed +2 -2
src/github.ts
+2 -2
@@ -80,7 +80,7 @@ export async function downloadPlugin(repo: Repo, { branch='', overwrite=false }=
80
81 async function go(url: string, folder: string, zipRoot: string) {
82 const installPath = PLUGINS_PATH + '/' + folder
83 - const tempInstallPath = installPath + '-' + DISABLING_SUFFIX
83 + const tempInstallPath = installPath + '-installing' + DISABLING_SUFFIX
84 const foldersToCopy = [ // from longer to shorter, so we first test the longer
85 zipRoot + '-' + process.platform + '-' + process.arch,
86 zipRoot + '-' + process.platform,
@@ -107,7 +107,7 @@ export async function downloadPlugin(repo: Repo, { branch='', overwrite=false }=
107 }
108 // delete old folder, but it may fail in the presence of .node files, so we rename it first as a precaution (clearing require.cache doesn't help)
109 const deleteMe = installPath + DELETE_ME_SUFFIX
110 - await rename(installPath, deleteMe)
110 + await rename(installPath, deleteMe).catch(() => {})
111 await rm(deleteMe, { recursive: true, force: true }).catch(e => console.warn(String(e)))
112 // final replace
113 await rename(tempInstallPath, installPath)