-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Files names are not sanitized under Android #7814
Comments
filenames (path elements) are sanitized in this function: https://github.com/arvidn/libtorrent/blob/RC_2_0/src/torrent_info.cpp#L158 As you can see, it differs between windows and other operating systems. For example, to determine whether a character is valid in a filename or not, this function is used: https://github.com/arvidn/libtorrent/blob/RC_2_0/src/torrent_info.cpp#L88 On linux, filenames and directory names are allowed to contain "?". Is that not the case on Android? |
Yes, it seems that '?' is not allowed under Android. At least on FAT file system which is used for SD cards. |
On windows, I believe the operating system restricts some characters, but I suspect that on Android it's the file system that limits valid characters. Perhaps FAT32 is common there. What I'm doing in that PR is an approximation. |
how does this look? #7828 |
Thanks, it became better than ever. :) Would it be possible to merge the fix into 1.2.x? |
That is a string literal. I don't know what would make it "raw". |
@arvidn I meant this: https://en.cppreference.com/w/cpp/language/string_literal. |
back-port: #7832 |
Please provide the following information
libtorrent version (or branch): 1.2.19
platform/architecture: Android
compiler and compiler version: clang
please describe what symptom you see, what you would expect to see instead and
how to reproduce it.
Try to download the following torrent under Android:
In meta data received signal you'll get a torrent with non-sanitized files names. This is not the case under Windows. For example, the second file of this torrent ("02. Orville Peck - How Far Will We Take It?.mp3"). Under Windows it's name in torrent object provided by Libtorrent is 02. Orville Peck - How Far Will We Take It_.mp3 ("?" replaced with "_"). However, under Android, this is not the case. And because of this, we get file creation failure.
The text was updated successfully, but these errors were encountered: