electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.72k stars 1.74k forks source link

Regression in nsis-web target for `appPackageUrl` option #8581

Open grovesNL opened 1 month ago

grovesNL commented 1 month ago

Since #6964 the appPackageUrl doesn't work as intended because extra paths are appended to the URL, which means it's not possible to download the latest at a single URL (see #7732 for an example).

My understanding is that APP_PACKAGE_URL_IS_INCOMPLETE intentionally tried to skip setting the package name based on architecture, instead using the name specified with appPackageUrl, but #6964 will use the regular naming.

mmaietta commented 1 month ago

Would you mind sharing a minimum reproducible repo/gist for this issue? I'd like to create a unit test for this

Re: the PR, I'm wondering if it's just safer to revert, but I'd still like to do the unit test to prevent future regressions.

AlijonMurodov commented 3 weeks ago

Hi would you like to share an example of nsis-web downloader. I made it but web-setup.exe says that 404 url not found. url is working. I upload x.nsis.7z file in github releases

 "publish":{
      "provider":"generic",
      "url": "https://github.com/AlijonMurodov/dark-mode/releases/download/1.0.0/dark-mode-1.0.0-x64.nsis.7z"
    }  
grovesNL commented 3 weeks ago

@mmaietta

Would you mind sharing a minimum reproducible repo/gist for this issue? I'd like to create a unit test for this

You could take any plain electron-builder setup and add something like this:

"nsisWeb": {
  "appPackageUrl": "https://website.example/latest.7z",
  "artifactName": "${productName} Setup.${ext}"
},

with any nsis-web target, so something like:

"win": {
  "target": [
    {
      "target": "nsis-web"
    }
  ]
}

The expectation is that we upload the produced 7z file at the location of the appPackageUrl, then the setup file will always be able to download the latest. This used to work but now it tries to download the package from a different URL similar to latest.7z/name-x64.nsis.7z instead of just latest.7z (the previous behavior).

AlijonMurodov commented 3 weeks ago

Thanks, it works fine. I found a bug which is I give full url to "appPackageUrl":"https://www.github.com/releases/download/1.0.0/package-name.nsis.7z" but programm tries to download url/package-name-${version}.nsis.7z. I think for now we need manually edit version number because program can't download latest version

github release example: "appPackageUrl":"https://github.com/AlijonMurodov/dark-mode/releases/download/1.0.0/"