tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
79.63k stars 2.37k forks source link

[bug] Updater does not pop open "Update App" dialog when the endpoint sends back 302 #7329

Closed vivekagate closed 12 months ago

vivekagate commented 1 year ago

Describe the bug

The link: https://github.com///releases/latest/download/latest.json returns a 302 that redirects to a different URL. The updater does not pop open the "Upgrade App dialog" Is this by design? or is it a bug? It would be great if updater can honor redirects to get the latest.json

Current workaround is to have the latest.json file as here: https://raw.githubusercontent.com///master/latest.json

Reproduction

Steps to reproduce:

Configure tauri.confi.json with the Updater snippet

"updater": { "active": true, "windows": { "installMode": "passive" }, "endpoints": [ "https://github.com/<owner>/<repo>/master/latest.json" ], "dialog": true, "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDU3NjlFREE5NUY3MDk3QTQKUldTa2wzQmZxZTFwVjRTRlNwVS9wZHgrUVJ2QUhOSnhqYURyZFA4L3AzUmgrLy9vVnFsQ01QckkK" },

Expected result: "Update app" dialog is shown when the app starts up.

Actual result: "Update app" dialog is not shown

Notes: Updater sends down HTTP GET to the endpoint and expects a JSON blob. In this case, the endpoint returns a 302 with the actual location of JSON.

Current workaround: Use an Endpoint of the form https://raw.githubusercontent.com/nirops/tradedog-public/master/latest.json

Expected behavior

Expected result: "Update app" dialog is shown when the app starts up.

Updater follows the redirects and obtains the latest.json

Platform and versions

[✔] Environment
    - OS: Ubuntu 20.04 X64
    ✔ webkit2gtk-4.0: 2.38.6
    ✔ rsvg2: 2.48.9
    ✔ rustc: 1.70.0 (90c541806 2023-05-31)
    ✔ Cargo: 1.70.0 (ec8a8a0ca 2023-04-25)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 16.16.0
    - yarn: 1.22.18
    - npm: 8.11.0

[-] Packages
    - tauri [RUST]: 1.4.1
    - tauri-build [RUST]: 1.4.0
    - wry [RUST]: 0.24.3
    - tao [RUST]: 0.16.2
    - @tauri-apps/api [NPM]: 1.4.0
    - @tauri-apps/cli [NPM]: 1.4.0

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist/tradedog
    - devPath: http://localhost:1420/
    - framework: Angular
    - bundler: Webpack

Stack trace

No response

Additional context

No response

FabianLars commented 1 year ago

For reference the discord conversation: https://discord.com/channels/616186924390023171/1124504085266186381

Note that it still works fine on my end using the same versions so idk what's really happening here (the json files looked alright to me)

amrbashir commented 1 year ago

Could you add the following to your Cargo.toml

[patch.crates-io]
tauri = { git = "https://github.com/tauri-apps/tauri", branch = "fix/updater/max-redirections" }

then run cargo update in src-tauri and see if it fixes the issue for your?

vivekagate commented 1 year ago

@amrbashir Yes that works!