Code style optimizations
This commit is contained in:
parent
600edca8cd
commit
8b925f852d
@ -1,8 +1,7 @@
|
|||||||
import aiohttp
|
|
||||||
from aiohttp import web
|
|
||||||
import asyncio
|
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
|
from aiohttp import web
|
||||||
|
|
||||||
|
|
||||||
class Rupload(web.Application):
|
class Rupload(web.Application):
|
||||||
def __init__(
|
def __init__(
|
||||||
@ -247,9 +246,7 @@ async def handle_upload(request: web.Request):
|
|||||||
print(f"File {filename} deleted.")
|
print(f"File {filename} deleted.")
|
||||||
return web.Response(
|
return web.Response(
|
||||||
status=413,
|
status=413,
|
||||||
text="File is too large. Maximum file size is {} bytes.".format(
|
text=f"File is too large. Maximum file size is {app.max_file_size} bytes.",
|
||||||
app.max_file_size
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
f.write(chunk)
|
f.write(chunk)
|
||||||
print(f"File {filename} uploaded successfully.")
|
print(f"File {filename} uploaded successfully.")
|
||||||
@ -281,7 +278,9 @@ async def handle_index(request: web.Request):
|
|||||||
message += f'<a href="{url}">'
|
message += f'<a href="{url}">'
|
||||||
message += f"{url}</a>"
|
message += f"{url}</a>"
|
||||||
if not message:
|
if not message:
|
||||||
message = "Any file type is allowed thus also binary/executable or source files."
|
message = (
|
||||||
|
"Any file type is allowed thus also binary/executable or source files."
|
||||||
|
)
|
||||||
if message:
|
if message:
|
||||||
message += "<br /><br />"
|
message += "<br /><br />"
|
||||||
html_content = html_content.replace("[message]", message)
|
html_content = html_content.replace("[message]", message)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
|
||||||
from rupload.app import create_app
|
from rupload.app import create_app
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user