Skip to content

Commit

Permalink
Merge pull request #83 from croservices/validate-file-fields
Browse files Browse the repository at this point in the history
Validate file inputs in forms
  • Loading branch information
Altai-man authored Oct 27, 2023
2 parents e2e5aad + 10919c4 commit 1a92bfd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Cro/WebApp/Form.rakumod
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use Cro::HTTP::Body;
use Cro::HTTP::MultiValue;
use Cro::HTTP::Router;

#| A role to be mixed in to Attribute to hold extra form-related properties.
my role FormProperties {
Expand Down Expand Up @@ -559,7 +560,7 @@ role Cro::WebApp::Form {
ensure-acceptable-type($attr, $attr.type);
}
multi sub ensure-acceptable-type(Attribute $attr, Mu $type --> Nil) {
unless $type ~~ Str || $type ~~ Real || $type ~~ Date || $type ~~ DateTime || Any ~~ $type {
unless $type ~~ Str || $type ~~ Real || $type ~~ Date || $type ~~ DateTime || $type ~~ Cro::HTTP::Body::MultiPartFormData || Any ~~ $type {
die "Don't know how to handle type '$type.^name()' of '$attr.name()' in a form";
}
}
Expand Down

0 comments on commit 1a92bfd

Please sign in to comment.