Skip to content

Torrent file stored in the database is not an exact copy of the uploaded torrent #242

@josecelano

Description

@josecelano

I've been working on some issues that require generating a torrent file. I have realized we are not storing an exact copy of the uploaded torrent.

How to reproduce

  1. Create a new torrent from scratch using qBittorrent v4.4.1

image

Using the imdl command and an online service (https://chocobo1.github.io/bencode_online/) I've extracted the torrent info from the torrent file:

$ imdl torrent show -j mandelbrot_2048x2048.png.torrent | jq
{
  "name": "mandelbrot_2048x2048.png",
  "comment": "Comments",
  "creation_date": 1690882922,
  "created_by": "qBittorrent v4.4.1",
  "source": "Source",
  "info_hash": "4f2ae7294f2c4865c38565f92a077d1591a0dd41",
  "torrent_size": 505,
  "content_size": 172204,
  "private": true,
  "tracker": "http://localhost",
  "announce_list": [],
  "update_url": null,
  "dht_nodes": [],
  "piece_size": 16384,
  "piece_count": 11,
  "file_count": 1,
  "files": [
    "mandelbrot_2048x2048.png"
  ]
}

https://chocobo1.github.io/bencode_online/

{
   "announce": "http://localhost",
   "comment": "Comments",
   "created by": "qBittorrent v4.4.1",
   "creation date": 1690882922,
   "info": {
      "length": 172204,
      "name": "mandelbrot_2048x2048.png",
      "piece length": 16384,
      "pieces": "<hex>7D 91 71 0D 9D 4D BA 88 9B 54 20 54 D5 26 72 8D 5A 86 3F E1 21 DF 77 C7 F7 BB 6C 77 96 21 66 25 38 C5 D9 CD AB 8B 08 EF 8C 24 9B B2 F5 C4 CD 2A DF 0B C0 0C F0 AD DF 72 90 E5 B6 41 4C 23 6C 47 9B 8E 9F 46 AA 0C 0D 8E D1 97 FF EE 68 8B 5F 34 A3 87 D7 71 C5 A6 F9 8E 2E A6 31 7C BD F0 F9 E2 23 F9 CC 80 AF 54 00 04 F9 85 69 1C 77 89 C1 76 4E D6 AA BF 61 A6 C2 80 99 AB B6 5F 60 2F 40 A8 25 BE 32 A3 3D 9D 07 0C 79 68 98 D4 9D 63 49 AF 20 58 66 26 6F 98 6B 6D 32 34 CD 7D 08 15 5E 1A D0 00 09 57 AB 30 3B 20 60 C1 DC 12 87 D6 F3 E7 45 4F 70 67 09 36 31 55 F2 20 F6 6C A5 15 6F 2C 89 95 69 16 53 81 7D 31 F1 B6 BD 37 42 CC 11 0B B2 FC 2B 49 A5 85 B6 FC 76 74 44 93</hex>",
      "private": 1,
      "source": "Source"
   },
   "url-list": "http://localhost/mandelbrot_2048x2048.png"
}
  1. Upload the torrent file to the Turrust Index.

  2. Download the torrent file from the Torrust Index

$ imdl torrent show -j mandelbrot.torrent | jq
{
  "name": "mandelbrot_2048x2048.png",
  "comment": null,
  "creation_date": null,
  "created_by": null,
  "source": null,
  "info_hash": "7ba0230159ed3b4ad368f81a592c13bad70b912e",
  "torrent_size": 401,
  "content_size": 172204,
  "private": true,
  "tracker": "udp://localhost:6969",
  "announce_list": [
    [
      "udp://localhost:6969"
    ]
  ],
  "update_url": null,
  "dht_nodes": [],
  "piece_size": 16384,
  "piece_count": 11,
  "file_count": 1,
  "files": [
    "mandelbrot_2048x2048.png"
  ]
}
{
   "announce": "udp://localhost:6969",
   "announce-list": [
      [
         "udp://localhost:6969"
      ]
   ],
   "info": {
      "length": 172204,
      "name": "mandelbrot_2048x2048.png",
      "piece length": 16384,
      "pieces": "<hex>7D 91 71 0D 9D 4D BA 88 9B 54 20 54 D5 26 72 8D 5A 86 3F E1 21 DF 77 C7 F7 BB 6C 77 96 21 66 25 38 C5 D9 CD AB 8B 08 EF 8C 24 9B B2 F5 C4 CD 2A DF 0B C0 0C F0 AD DF 72 90 E5 B6 41 4C 23 6C 47 9B 8E 9F 46 AA 0C 0D 8E D1 97 FF EE 68 8B 5F 34 A3 87 D7 71 C5 A6 F9 8E 2E A6 31 7C BD F0 F9 E2 23 F9 CC 80 AF 54 00 04 F9 85 69 1C 77 89 C1 76 4E D6 AA BF 61 A6 C2 80 99 AB B6 5F 60 2F 40 A8 25 BE 32 A3 3D 9D 07 0C 79 68 98 D4 9D 63 49 AF 20 58 66 26 6F 98 6B 6D 32 34 CD 7D 08 15 5E 1A D0 00 09 57 AB 30 3B 20 60 C1 DC 12 87 D6 F3 E7 45 4F 70 67 09 36 31 55 F2 20 F6 6C A5 15 6F 2C 89 95 69 16 53 81 7D 31 F1 B6 BD 37 42 CC 11 0B B2 FC 2B 49 A5 85 B6 FC 76 74 44 93</hex>",
      "private": 1
   }
}

Missing attributes

I think we are not saving these fields:

  • creation_date
  • created_by
  • source
  • update_url
  • dht_nodes

Infohash is different!

As you can see, the infohash of the uploaded torrent is 4f2ae7294f2c4865c38565f92a077d1591a0dd41 but when you download it, the new infohash is 7ba0230159ed3b4ad368f81a592c13bad70b912e because fields are not the same.

I think we should store and exact copy of the torrent. What do you think @da2ce7?

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIncorrect Behavior

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions