We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0963493 commit 0737b7eCopy full SHA for 0737b7e
app/user_manager.py
@@ -363,10 +363,17 @@ async def post_userdata(request):
363
if not overwrite and os.path.exists(path):
364
return web.Response(status=409, text="File already exists")
365
366
- body = await request.read()
+ try:
367
+ body = await request.read()
368
- with open(path, "wb") as f:
369
- f.write(body)
+ with open(path, "wb") as f:
370
+ f.write(body)
371
+ except OSError as e:
372
+ logging.warning(f"Error saving file '{path}': {e}")
373
+ return web.Response(
374
+ status=400,
375
+ reason="Invalid filename. Please avoid special characters like :\\/*?\"<>|"
376
+ )
377
378
user_path = self.get_request_user_filepath(request, None)
379
if full_info:
0 commit comments