Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ All parameters can have default values, and automatic validation.

These validators are passed into the classes in the route function, such as:
* `username: str = Json("defaultusername", min_length=5)`
* `profile_picture: Any = File(content_types=["image/png", "image/jpeg"])`
* `profile_picture: werkzeug.datastructures.FileStorage = File(content_types=["image/png", "image/jpeg"])`
* `filter: str = Query()`

### Overwriting default errors
Expand Down
6 changes: 4 additions & 2 deletions flask_parameter_validation/parameter_types/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ def __init__(
min_length=None, # Minimum file content-length
max_length=None # Maximum file content-length
):
super().__init__(default, min_length=min_length, max_length=max_length)
self.content_types = content_types # Array of content type strs
super().__init__(default)
self.content_types = content_types
self.min_length = min_length
self.max_length = max_length

def validate(self, value):
# Content type validation
Expand Down