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 10
10
from slowapi import Limiter , _rate_limit_exceeded_handler
11
11
from slowapi .util import get_remote_address
12
12
from .utils import generate_uuid
13
+ from .middleware import LimitUploadSize
13
14
14
15
limiter = Limiter (key_func = get_remote_address )
15
16
app = FastAPI (title = "paste.py 🐍" )
26
27
allow_headers = ["*" ],
27
28
)
28
29
30
+ app .add_middleware (LimitUploadSize , max_upload_size = 20_000_000 ) # ~20MB
31
+
29
32
large_uuid_storage = []
30
33
31
34
BASE_DIR = Path (__file__ ).resolve ().parent
@@ -58,7 +61,7 @@ async def post_as_a_file(request: Request, file: UploadFile = File(...)):
58
61
59
62
60
63
@app .get ("/paste/{uuid}" )
61
- async def post_as_a_text (uuid ):
64
+ async def get_paste_data (uuid ):
62
65
path = f"data/{ uuid } "
63
66
try :
64
67
with open (path , "rb" ) as f :
You can’t perform that action at this time.
0 commit comments