osuAkatsuki / bancho.py

An osu! server for the generic public, optimized for maintainability in modern python
https://akatsuki.gg
MIT License
212 stars 127 forks source link

bug: Error when trying to get multiplayer information using api #452

Closed mames1dev closed 1 year ago

mames1dev commented 1 year ago

Describe the bug

Access api./v1/get_match?id=1.

An error occurs and an Internal Error is generated

To Reproduce

Access api./v1/get_match?id=1

An error occurs and an Internal Error is generated

Expected behavior

The premise was that one room could not call the api. room 0 should not have been created, but it was and could not be called from the api. when a second room was created, calling the room's id number 1 generated an error. English may be incorrect because of the use of translation software

bancho.py Version

4.8.1

Python Version

3.9.X (Default)

Relevant log output

File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/middleware/base.py", line 70, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/middleware
    raise app_exc
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/middleware/base.py", line 70, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
    response = await self.dispatch_func(request, call_next)
  File "/root/bancho.py/app/api/init_api.py", line 100, in http_middleware
    return await call_next(request)
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/middleware/base.py", line 84, in call_next
    raise app_exc
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/middleware/base.py", line 70, in coro
    response = await call_next(request)
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/middleware/base.py", line 84, in call_next
    raise app_exc
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/middleware/base.py", line 70, in coro
    response = await self.dispatch_func(request, call_next)
  File "/root/bancho.py/app/api/init_api.py", line 100, in http_middleware
    return await call_next(request)
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/middleware/base.py", line 84, in call_next
    raise app_exc
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/middleware/base.py", line 70, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/middleware/base.py", line 108, in __call__
    response = await self.dispatch_func(request, call_next)
  File "/root/bancho.py/app/api/middlewares.py", line 23, in dispatch
    response = await call_next(request)
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/middleware/base.py", line 84, in call_next
    raise app_exc
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/middleware/base.py", line 70, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/routing.py", line 706, in __call__
    await route.handle(scope, receive, send)
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/routing.py", line 515, in handle
    await self.app(scope, receive, send)
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/routing.py", line 706, in __call__
    await route.handle(scope, receive, send)
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/fastapi/routing.py", line 237, in app
    raw_response = await run_endpoint_function(
  File "/root/bancho.py/.venv/lib/python3.9/site-packages/fastapi/routing.py", line 163, in run_endpoint_function
    return await dependant.call(**values)
  File "/root/bancho.py/app/api/v1/api.py", line 866, in api_get_match
    "mode": match.mode.as_vanilla,
AttributeError: 'int' object has no attribute 'as_vanilla'

Additional context

No response

cmyui commented 1 year ago

Thanks for the report!