File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 1010from slowapi import Limiter , _rate_limit_exceeded_handler
1111from slowapi .util import get_remote_address
1212from .utils import generate_uuid
13+ from .middleware import LimitUploadSize
1314
1415limiter = Limiter (key_func = get_remote_address )
1516app = FastAPI (title = "paste.py 🐍" )
2627 allow_headers = ["*" ],
2728)
2829
30+ app .add_middleware (LimitUploadSize , max_upload_size = 20_000_000 ) # ~20MB
31+
2932large_uuid_storage = []
3033
3134BASE_DIR = Path (__file__ ).resolve ().parent
@@ -58,7 +61,7 @@ async def post_as_a_file(request: Request, file: UploadFile = File(...)):
5861
5962
6063@app .get ("/paste/{uuid}" )
61- async def post_as_a_text (uuid ):
64+ async def get_paste_data (uuid ):
6265 path = f"data/{ uuid } "
6366 try :
6467 with open (path , "rb" ) as f :
You can’t perform that action at this time.
0 commit comments