From 4104dbfed2dd308e3461c853b3dfbb3edd269fa8 Mon Sep 17 00:00:00 2001 From: Nate Clark Date: Wed, 23 Aug 2017 10:58:56 -0700 Subject: [PATCH] fix for older devices without a local manifest --- src/manifest.json | 12 ++++++------ src/update_manifest.lua | 2 +- src/update_process.lua | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/manifest.json b/src/manifest.json index 9a56136..c4c3f4a 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -7,9 +7,9 @@ "src/http_index.html.gz":"e1149f19e459500c32273dbdacbcfa978db16364", "src/httpd_req.lua":"80053674f20f087e58e1cfd490fc71e6cdd92acf", "src/httpd_res.lua":"7226f19699168e171970cda73b953a49450b7aa8", - "src/init.lua":"a24bbe72c66f4836b012a878177f65f4b9bd3a0d", + "src/init.lua":"cc93595d2dfdeb609d78c666f9ed16aed86b6ada", "src/led_flip.lua":"590e7be1afe686f4213d097d0e9dba9e7a3910a0", - "src/manifest.json":"686581e56994fb7714945d19204428c944e53ed3", + "src/manifest.json":"9a56136c34249f85175b2f1c6e20be0bc9d356c1", "src/sensors.lua":"d0d94fa73f713dcf2c517da9262f59f306b81d2b", "src/server.lua":"c7f09f0a626587ced6399948fc1719dd248f3f01", "src/server_device.lua":"dca5e6501b4836d120cadc20538999387c9c54d1", @@ -18,10 +18,10 @@ "src/smartthings.lua":"ae11130360416aec5c2505c06850c5a4cd0449da", "src/ssdp.lua":"f2776ae2c333093e3d954950f13d77b3d880aee1", "src/start.lua":"af90c766d9afa65c6cbcddacb7ab91124b3598c6", - "src/update.lua":"b7274646098895b2a95c1ac0530c0c08780681a7", - "src/update_manifest.lua":"0c113061f43ed2d367d67ea254c6dc81c1a2ec73", - "src/update_process.lua":"ff202f244409fcdbc706989c2977d189ecfe894c", + "src/update.lua":"3d2f52af3873583b08e387759b9e32b4f659c357", + "src/update_manifest.lua":"dddbf60e48a50ab0bbafa2ad95a4f4a9f448b3a4", + "src/update_process.lua":"079934b760007888f338da007599962ea672afa1", "src/variables_build.lua":"0029cb028698822ee981c35bcf84710c19e21486", "src/variables_set.lua":"2c2d9c13c8acb577d80f40e4b513c7cd23ffdd1f", - "updated_at":"2017-08-23:07:21:07" + "updated_at":"2017-08-23:18:45:10" } diff --git a/src/update_manifest.lua b/src/update_manifest.lua index 0c11306..dddbf60 100644 --- a/src/update_manifest.lua +++ b/src/update_manifest.lua @@ -12,7 +12,7 @@ local download_new_manifest = function() local new_manifest = cjson.decode(data) print("Heap: ", node.heap(), "downloaded updated manifest.json") local file_size = file.list()['manifest.json'] - local current_manifest + local current_manifest = {} -- open the existing manifest.json on the device for comparing file SHAs if file.open("manifest.json") then diff --git a/src/update_process.lua b/src/update_process.lua index ff202f2..079934b 100644 --- a/src/update_process.lua +++ b/src/update_process.lua @@ -1,6 +1,6 @@ local proceed local function getHeaderValue(line, headerPattern) - local l1 = string.match(line, headerPattern .. ": (.*)") + local l1 = string.match(line, "^" .. headerPattern .. ": (.*)") if l1 then local l2 = string.sub(l1, 1, ( string.find(l1, "\r\n") - 1 )) return l2