Electron Squirrel Auto Updater远程服务器返回错误:(308)永久重定向

axr492tv  于 6个月前  发布在  Electron
关注(0)|答案(1)|浏览(104)

我试图为我的电子应用程序做一个自动更新程序,并使用Hazel作为更新服务器,但当我尝试这一点,并测试它,下面的electron guide的每一步,它总是会给我给予这些错误的Squirrel-CheckForUpdate.log文件:

[10/12/23 11:54:19] info: FileDownloader: Downloading url: https://cbsh-updater.vercel.app//update/win32/1.0.2/releases?id=bellschedoverlay&localversion=1.0.2&arch=amd64
[10/12/23 11:54:19] warn: IEnableLogger: Failed to download url: https://cbsh-updater.vercel.app//update/win32/1.0.2/releases?id=bellschedoverlay&localversion=1.0.2&arch=amd64: System.Net.WebException: The remote server returned an error: (308) Permanent Redirect.
[10/12/23 11:54:19] info: CheckForUpdateImpl: Download resulted in WebException (returning blank release list): System.Net.WebException: The remote server returned an error: (308) Permanent Redirect.
[10/12/23 11:54:19] fatal: Finished with unhandled exception: System.AggregateException: One or more errors occurred. ---> System.Net.WebException: The remote server returned an error: (308) Permanent Redirect.

这些错误之间有堆栈跟踪,这就是我将它们分开的原因。
下面是我的代码:

function checkForUpdates() {
  if (app.isPackaged){
    const server = config.hazelUpdateURL;
    const url = `${server}/update/${process.platform}/${app.getVersion()}`;

    autoUpdater.setFeedURL({ url });

    autoUpdater.checkForUpdates();
    
  }
}

autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {

dialog.showMessageBox({
    type: 'info',
    buttons: ['Restart', 'Later'],
    title: 'Application Update',
    message: process.platform === 'win32' ? releaseNotes : releaseName,
    detail:
      'A new version of the Crooms Bell Schedule has been downloaded. Restart the application to apply the updates.'
  }).then((returnValue) => {
    if (returnValue.response === 0) autoUpdater.quitAndInstall()
  });

})

autoUpdater.on('error', (message) => {
  console.error('There was a problem updating the application');
  console.error(message);
});

checkForUpdates();


我尝试了在浏览器中下载失败的URL,它成功地下载了RELEASES文件,并包含预期的内容,但在devtools的网络选项卡中显示了308状态代码。
如何忽略此错误并强制下载RELEASES文件,即使它是重定向?

ymdaylpp

ymdaylpp1#

没关系,这个问题只发生在我的主计算机上;我拥有的所有其他计算机都自动更新。

相关问题