From ef9d514a0179ad043c5fc5db0cd3d6aa9f46be4b Mon Sep 17 00:00:00 2001 From: Adrian Crisan Date: Thu, 11 Feb 2016 12:09:19 +0200 Subject: [PATCH] Validate Uploaded files by default --- lib/Mojolicious/Plugin/ValidateTiny.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Mojolicious/Plugin/ValidateTiny.pm b/lib/Mojolicious/Plugin/ValidateTiny.pm index edc8654..799fd1e 100644 --- a/lib/Mojolicious/Plugin/ValidateTiny.pm +++ b/lib/Mojolicious/Plugin/ValidateTiny.pm @@ -36,6 +36,9 @@ sub register { # Validate GET+POST parameters by default $params ||= $c->req->params->to_hash(); + # Validate Uploaded files by default + $params->{ $_->name } ||= $_ for (@{ $c->req->uploads }); + #Latest mojolicious has an issue in that it doesn't include route supplied parameters so we need to hack that in. $params = { %{$params}, %{$c->stash->{'mojo.captures'}} };