Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.14] ValueError: missing or invalid info section in torrent file (in ChannelsEndpoint.add_torrent_to_channel) #8069

Closed
kozlovsky opened this issue Jul 1, 2024 · 3 comments
Assignees

Comments

@kozlovsky
Copy link
Contributor

RuntimeError: missing or invalid 'info' section in torrent file
  File "src\<relief>\core\components\libtorrent\torrentdef.py", line 64, in __init__
ValueError: missing or invalid 'info' section in torrent file
  File "src\<relief>\core\components\restapi\rest\rest_manager.py", line 53, in error_middleware
  File "C:\Users\<relief>\AppData\Local\Programs\Python\Python38\lib\site-packages\aiohttp\web_middlewares.py", line 117, in impl
  File "src\<relief>\core\components\metadata_store\restapi\channels_endpoint.py", line 440, in add_torrent_to_channel
  File "src\<relief>\core\components\libtorrent\torrentdef.py", line 117, in load_from_memory
  File "src\<relief>\core\components\libtorrent\torrentdef.py", line 125, in load_from_dict
  File "src\<relief>\core\components\libtorrent\torrentdef.py", line 66, in __init__

Here:

    async def add_torrent_to_channel(self, request):
        ...

        if not parameters.get('torrent', None):
            return RESTResponse({"error": "torrent parameter missing"}, status=HTTP_BAD_REQUEST)

        # Try to parse the torrent data
        # Any errors will be handled by the error_middleware
        torrent = base64.b64decode(parameters['torrent'])
        torrent_def = TorrentDef.load_from_memory(torrent)  # <-- here

The erroneous torrent metadata was:

{
    b'announce': "b'/announce?pid='"
}

It looks like the endpoint code should handle ValueError and return RESTResponse with an error description.

Copy link

Sentry issue: TRIBLER-1SD

@drew2a
Copy link
Contributor

drew2a commented Jul 2, 2024

Exactly this occurrence should be fixed in:

However, TorrentDef.load_from_memory is used in two more places.

@drew2a drew2a self-assigned this Jul 2, 2024
@drew2a drew2a added this to the 7.15.0 milestone Jul 2, 2024
@drew2a
Copy link
Contributor

drew2a commented Jul 4, 2024

The remaining calls to TorrentDef.load_from_memory do not lead to an application crash; therefore, I'm closing the issue.

@drew2a drew2a closed this as completed Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants