Skip to content

On the torrent details endpoint redirect to the canonical info-hash if other original info-hash is used #278

@josecelano

Description

@josecelano

Parent issue: #275

Endpoint: GET http://localhost:3001/v1/torrent/0c90fbf036e28370c1ec773401bc7620146b1d48

Change torrent details endpoint returning 302 when the user uses any of the original infohashes if it's not the canonical one.

Context

After merging this PR #269, the Index stores the canonical infohash and the original infohash.

The infohash of the uploaded torrent might change if it contains a non-standard field in the info dictionary.

Problem

If you request the torrent details endpoint GET /v1/torrent/CANONICAL_INFOHASH the API will respond with a 404 status code because it only works with the canonical infohash.

Solution

Return a 302 Found pointing to the same endpoint using the canonical infohash.

We will use a temporary redirect instead of a permanent one because, in the future, we could return different data for the torrent with the canonical infohash and for other torrents in the canonical infohash group (torrents sharing the same canonical infohash).

cc @da2ce7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions