diff --git a/fhem/FHEM/98_configdb.pm b/fhem/FHEM/98_configdb.pm index 87ff51fe3..49695c09c 100644 --- a/fhem/FHEM/98_configdb.pm +++ b/fhem/FHEM/98_configdb.pm @@ -226,6 +226,11 @@ sub CommandConfigdb($$) { return _cfgDB_Filelist; } + when ('fileshow') { + my $r = _cfgDB_Readfile($param1); + return ($r)?$r:"File $param1 not found in database."; + } + when ('info') { Log3('configdb', 4, "info requested."); $ret = _cfgDB_Info; diff --git a/fhem/configDB.pm b/fhem/configDB.pm index 78efdd362..ab0c0704d 100644 --- a/fhem/configDB.pm +++ b/fhem/configDB.pm @@ -734,7 +734,7 @@ sub _cfgDB_Readfile($) { $sth->execute(); my @outfile; while (my @line = $sth->fetchrow_array()) { - push @outfile, "$line[0] "; + push @outfile, "$line[0]"; } $sth->finish(); $fhem_dbh->disconnect(); @@ -749,7 +749,7 @@ sub _cfgDB_Writefile($$) { $fhem_dbh->do("delete from fhemfilesave where filename = '$filename'"); my $sth = $fhem_dbh->prepare('INSERT INTO fhemfilesave values (?, ?)'); foreach (@c){ - $sth->execute($filename,$_); + $sth->execute($filename,rtrim($_)); } $sth->finish(); $fhem_dbh->commit();