diff --git a/MANIFEST.in b/MANIFEST.in index 976f250d..e6f1d79b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,3 +4,16 @@ include README.md global-include *.typed recursive-include navigator/templates * recursive-include navigator/static * +# Exclude directories +prune videos +prune examples +prune docs +prune documents +prune etc +prune env +prune resources +prune dist + +# Optionally, you can also specify any other unwanted directories +prune tests +prune *.egg-info diff --git a/navigator/version.py b/navigator/version.py index facb8379..034aa273 100644 --- a/navigator/version.py +++ b/navigator/version.py @@ -4,7 +4,7 @@ __description__ = ( "Navigator Web Framework based on aiohttp, " "with batteries included." ) -__version__ = "2.10.23" +__version__ = "2.10.24" __author__ = "Jesus Lara" __author_email__ = "jesuslarag@gmail.com" __license__ = "BSD" diff --git a/navigator/views/base.py b/navigator/views/base.py index ed793b8e..d0dd257f 100644 --- a/navigator/views/base.py +++ b/navigator/views/base.py @@ -489,11 +489,12 @@ async def handle_upload( status=406, content_type='application/json' ) + form_data = {} uploaded_files = [] try: reader = await request.multipart() except KeyError: - return {'error': 'No file uploaded'} + raise FileNotFoundError("No File Uploaded") # Process each part of the multipart request async for part in reader: @@ -521,9 +522,12 @@ async def handle_upload( break f.write(chunk) uploaded_files.append(temp_file_path) - if not uploaded_files: - return {'error': 'No file uploaded'} - return {'files': uploaded_files} + else: + # If it's a form field, add it to the dictionary + form_field_name = part.name + form_field_value = await part.text() # Read the value as text + form_data[form_field_name] = form_field_value + return uploaded_files, form_data async def delete_uploaded_files(self, file_paths: list): """delete_uploaded_files.