qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
27.03k stars 3.89k forks source link

creating a torrent for a file which name starts with a dot causing "no files in torrent [libtorrent:16]." error #20790

Open DmitriyWZR opened 4 months ago

DmitriyWZR commented 4 months ago

qBittorrent & operating system versions

qBittorrent: v5.0.0beta1 (64-bit) Operating system: Windows 11 Pro 26200 x64 Qt: 6.7.0 libtorrent: 2.0.10.0

What is the problem?

creating a .torrent for a file which name starts with a dot causing "no files in torrent [libtorrent:16]." error. Such files are acceptible in Windows and must be processed.

Steps to reproduce

  1. In WIndows create file named started with a dot
  2. Create .torrent for just this file only (bug)
  3. Rename without a dot (no bug)

Additional context

изображение

Log(s) & preferences file(s)

No response

stalkerok commented 4 months ago

Confirmed. 2024-05-02_084007

Chocobo1 commented 4 months ago

https://github.com/qbittorrent/qBittorrent/blob/cd3982cf3cde821a3dd0793307ea4b22358a0df1/src/base/bittorrent/torrentcreator.cpp#L54-L57 Also read this: https://en.wikipedia.org/wiki/Hidden_file_and_hidden_directory#Unix_and_Unix-like_environments

Although Windows do not treat a dotfile as hidden file, users might still have expectations of filtering out dotfiles. It would be questionable of why a Windows user would include dotfile in .torrent.

stalkerok commented 4 months ago

Don't you think this restriction is unnecessary? It can be left for filtering single dot files (.txt, not .test.txt), besides it can be bypassed by creating a torrent on a folder with such a file, which is good, otherwise it would cause big problems for multi-file torrents.

Chocobo1 commented 4 months ago

It can be left for filtering single dot files (.txt, not .test.txt),

I can imagine a linux user complain why his .dotfile.someRandomText won't be excluded.

besides it can be bypassed by creating a torrent on a folder with such a file, which is good, otherwise it would cause big problems for multi-file torrents.

No, from my testing the dotfiles will be excluded even if it is located within a folder. IIRC some macOS user prefer to exclude .ds_store when creating torrents.

https://en.wikipedia.org/wiki/.DS_Store ... It is created and maintained by the Finder application in every folder, ...

Also this filter has been there for more than 10 years. It is not clear to me what use case @DmitriyWZR is trying to do (other than saying it is a valid filename for Windows).

I'm open to proposals, it is just there are no clear path forward at this point. We can adjust the filter to be adaptive for every native OS/platform and personally I would prefer this, but it is still hard to say that users won't want the filter to be cross-platform.

glassez commented 4 months ago

I'm open to proposals, it is just there are no clear path forward at this point. We can adjust the filter to be adaptive for every native OS/platform and personally I would prefer this, but it is still hard to say that users won't want the filter to be cross-platform.

...or we could allow user to adjust it via torrent creator UI.

Chocobo1 commented 4 months ago

...or we could allow user to adjust it via torrent creator UI.

It is not clear what the user want (or even necessary). Would a regex input suffice? But regex won't suffice for Windows user if they want to filter out hidden files (which is a file property, not filename related).

glassez commented 4 months ago

...or we could allow user to adjust it via torrent creator UI.

It is not clear what the user want (or even necessary). Would a regex input suffice? But regex won't suffice for Windows user if they want to filter out hidden files (which is a file property, not filename related).

It was just one of the possible ideas.

Due to the fact that torrents are distributed between different platforms, I feel it is normal to exclude such files regardless of which platform the torrent is created on (as it is done now). The only improvement I could still suggest is to pre-check the files and display a warning if any of them are filtered out.

stalkerok commented 4 months ago

No, from my testing the dotfiles will be excluded even if it is located within a folder.

2024-05-02_130617 I've come across torrents where the files only had the extension and were necessary (game or app), if they weren't there, there would definitely be problems running them.

stalkerok commented 4 months ago

We can adjust the filter to be adaptive for every native OS/platform and personally I would prefer this, but it is still hard to say that users won't want the filter to be cross-platform.

👍

The only improvement I could still suggest is to pre-check the files and display a warning if any of them are filtered out.

👍

Chocobo1 commented 4 months ago

2024-05-02_130617

I found my mistake in my testing.

I've come across torrents where the files only had the extension and were necessary (game or app), if they weren't there, there would definitely be problems running them.

So it really indicates that we need it user configurable. Perhaps a checkbox stating "Exclude dotfiles" would be enough? (it will be applied to both single-file torrent and multi-files torrent)

DmitriyWZR commented 4 months ago

This discussion is... Strange. 1) It's straight as air clean, what "what the user want (or even necessary)". Just create a .torrent for a file which starts with a dot. Like in any other app. Specifically here is to inform you this issue exists. I don't even beg someone to fix it. I'll use another app to create a .torrent, no big deal. If a 10 years bug is dear to someone of the dev team, well i don't suffer in any form. 2) Why to hash a file, starting with a dot? Well cause content that starts with a dot simply exists. 3) Different platforms may have different file name restrictions. That doesn't mean i must follow them all when creating a .torrent. Doesn't mean an app should guide me to do it either. No, we don't need any checkboxes. It's up to user (or user client) to know his restrictions. If he face some incompatibility, he will rename a file (qbittorrent supports it). Any "special filter" conspirancy is a lie cause such files can be processed inside a folder with no issue. It's just a bug. 4) "Put a file in folder", etc. is a crutch. Unnecessary and not allowed by some trackers.