leanflutter / auto_updater

This plugin allows Flutter desktop apps to automatically update themselves (based on sparkle and winsparkle).
MIT License
285 stars 41 forks source link

[Windows] downloading update files fails for relative urls #22

Open obiwanzenobi opened 2 years ago

obiwanzenobi commented 2 years ago

If I create appcast like in the example with relative update files urls, then download procedure fails on windows. Everything works well if url is an absolute one like https://you.com/update.exe

            <enclosure url="1.1.0+2/auto_updater_example-1.1.0+2-windows.exe"
                       sparkle:dsaSignature="MEUCIQCVbVzVID7H3aUzAY5znpi+ySZKznkukV8whlMFzKh66AIgREUGOmvavlcg6hwAwkb2o4IqVE/D56ipIBshIqCH8rk="
                       sparkle:version="1.1.0"
                       sparkle:os="windows"
                       length="0"
                       type="application/octet-stream" />

This is probably because of this line in win sparkle code: https://github.com/vslavik/winsparkle/blob/b246977b9666953af6c647b36317add7a4e6250b/src/download.cpp#L200

Maybe windows implementation could be switched to one supporting relative urls to preserve compatibility with macos sparkle. https://github.com/NetSparkleUpdater/NetSparkle https://github.com/NetSparkleUpdater/NetSparkle/issues/57

ksm-android commented 1 year ago

Instead of the relative URL use http://localhost:5000/1.1.0+2/auto_updater_example-1.1.0+2-windows.exe.

Here localhost:5000 will be your local server domain.