word/report: ignore empty history post data
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 20 Dec 2023 22:53:19 +0000 (23:53 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 28 Dec 2023 07:19:58 +0000 (08:19 +0100)
Prevent exception on invalid calls.

word/report.plp

index 56d6188eb002ef5c65a30fc309dd1ccb44efbab5..c40b0af13077212d4644df0ac4822a1b99be2dac 100644 (file)
@@ -8,5 +8,5 @@ $db->insert(report => {
        agent   => $ENV{HTTP_USER_AGENT},
        page    => $ENV{HTTP_REFERER},
        address => $ENV{REMOTE_ADDR},
-       history => $PLP::read->($ENV{CONTENT_LENGTH}),
+       history => (map {$_ ? $PLP::read->($_) : undef} $ENV{CONTENT_LENGTH}),
 });