Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed OtaMagic handling having minus "-" within OtaUrl #3563

Merged
merged 1 commit into from
Aug 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions sonoff/sonoff.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1975,8 +1975,9 @@ void StateLoop()
strlcpy(mqtt_data, GetOtaUrl(log_data, sizeof(log_data)), sizeof(mqtt_data));
#ifndef BE_MINIMAL
if (RtcSettings.ota_loader) {
char *pch = strrchr(mqtt_data, '-'); // Change from filename-DE.bin into filename-minimal.bin
char *ech = strrchr(mqtt_data, '.'); // Change from filename.bin into filename-minimal.bin
char *bch = strrchr(mqtt_data, '/'); // only consider filename after last backslash prevent change of urls having "-" in it
char *pch = strrchr((bch!=NULL)?bch:mqtt_data, '-'); // Change from filename-DE.bin into filename-minimal.bin
char *ech = strrchr((bch!=NULL)?bch:mqtt_data, '.'); // Change from filename.bin into filename-minimal.bin
if (!pch) pch = ech;
if (pch) {
mqtt_data[pch - mqtt_data] = '\0';
Expand Down