From 5a582533b8fb5d4f3c81ba8231a6cf60ccde16e4 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Thu, 7 Jan 2021 20:04:41 +0000 Subject: [PATCH] 50_SSFile: contrib 0.7.7 git-svn-id: https://svn.fhem.de/fhem/trunk@23488 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/50_SSFile.pm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fhem/contrib/DS_Starter/50_SSFile.pm b/fhem/contrib/DS_Starter/50_SSFile.pm index d80b9d19b..340af33cb 100644 --- a/fhem/contrib/DS_Starter/50_SSFile.pm +++ b/fhem/contrib/DS_Starter/50_SSFile.pm @@ -3,7 +3,7 @@ ######################################################################################################################### # 50_SSFile.pm # -# (c) 2020 by Heiko Maaz +# (c) 2020-2021 by Heiko Maaz # e-mail: Heiko dot Maaz at t-online dot de # # This Module integrate the Synology File Station into FHEM @@ -144,6 +144,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( + "0.7.7" => "07.01.2021 avoid FHEM crash if Cache file content is not valid JSON format ", "0.7.6" => "20.12.2020 minor change to avoid increase memory ", "0.7.5" => "07.12.2020 minor fix avoid overtakers ", "0.7.4" => "30.11.2020 add mtime, crtime to uploaded files ", @@ -1273,7 +1274,14 @@ sub initOnBoot { if(!$error) { my $json = join "", @content; - $data{$type}{$name}{uploaded} = decode_json ($json); + my $success = evaljson ($hash, $json); # V0.7.7 07.01.2021 + + if($success) { + $data{$type}{$name}{uploaded} = decode_json ($json); + } + else { + Log3($name, 2, qq{$name - WARNING - the content of file "$file" is not readable and may be corrupt}); + } } readingsBeginUpdate($hash); @@ -1640,7 +1648,7 @@ sub execOp_parse { } elsif ($myjson ne "") { # wenn die Abfrage erfolgreich war ($data enthält die Ergebnisdaten des HTTP Aufrufes) if($opmode ne "download") { - ($success) = evaljson($hash,$myjson); + $success = evaljson ($hash, $myjson); if (!$success) { Log3 ($name, 4, "$name - Data returned: ".$myjson);