esphome / esp-web-tools

Open source tools to allow working with ESP devices in the browser
https://esphome.github.io/esp-web-tools/
Apache License 2.0
449 stars 120 forks source link

Non-existent firmware will be upload, need to check it it exists before trying to flash #488

Closed mineshaftgap closed 7 months ago

mineshaftgap commented 8 months ago

In manifest.json if there is a typo, self-hosted ESP Web Tools will try and upload a non-existent firmware resulting in a boot loop of:

invalid header: 0x434c4557

More details can be found in a previously related ticket. I suggest that checking for the existence of the file before trying to upload or in that is not possible to do a file size check.

balloob commented 7 months ago

We check if the status code is correct:

https://github.com/esphome/esp-web-tools/blob/ec35b6aa693146432dad48b99b631b45bcae69b3/src/flash.ts#L119-L124

Web servers should return a 404 status code if the file is not found. If that is not the case, your web server is misconfigured.