filenames #400

Closed
opened 2026-02-20 23:03:01 -05:00 by deekerman · 7 comments
Owner

Originally created by @kickerofelves on GitHub (Nov 25, 2012).

In the old days, youtube-dl did a fine job of sanitizing filenames. At some point recently, the '&' no long became rewritten as '_'. This is bad for *nix. Now I do an update and see the results of this commit github.com/rg3/youtube-dl@42cb53fcfa removing the underscores. I don't see how this is smarter. Now I can't simply double click to capture the entire filename. Please change it back.

Originally created by @kickerofelves on GitHub (Nov 25, 2012). In the old days, youtube-dl did a fine job of sanitizing filenames. At some point recently, the '&' no long became rewritten as '_'. This is bad for *nix. Now I do an update and see the results of this commit https://github.com/rg3/youtube-dl/commit/42cb53fcfa2e8bbc7a96bc1a0ad1e90c1917dccd removing the underscores. I don't see how this is smarter. Now I can't simply double click to capture the entire filename. Please change it back.
Author
Owner

@phihag commented on GitHub (Nov 25, 2012):

I'm regularily using youtube-dl on a Linux system and can't follow why ampersands should be bad for *nix. Can you elaborate?

In any case, if this affects just the ampersand and it is really a serious impediment for multiple users, I'm fine with blacklisting that character (or replacing it with underscores).

Personally, I'd prefer a video filename like AT&T.mp4 to AT_T.mp4, and every shell from this millenium will automatically escape those characters when one presses Tab anyways. @FiloSottile What would you prefer?

@phihag commented on GitHub (Nov 25, 2012): I'm regularily using youtube-dl on a Linux system and can't follow why ampersands should be bad for *nix. Can you elaborate? In any case, if this affects just the ampersand and it is really a serious impediment for multiple users, I'm fine with blacklisting that character (or replacing it with underscores). Personally, I'd prefer a video filename like `AT&T.mp4` to `AT_T.mp4`, and every shell from this millenium will automatically escape those characters when one presses `Tab` anyways. @FiloSottile What would you prefer?
Author
Owner

@FiloSottile commented on GitHub (Nov 26, 2012):

Every shell has its special characters, and a shell user needs to account for those by himself, as we can't possibly escape them all. I would keep the &.

Also, I thought that he was having issues with the & in he URL (probably read too fast). If so, there's nothing we can do about it anyway.

@FiloSottile commented on GitHub (Nov 26, 2012): Every shell has its special characters, and a shell user needs to account for those by himself, as we can't possibly escape them all. I would keep the &. Also, I thought that he was having issues with the & in he URL (probably read too fast). If so, there's nothing we can do about it anyway.
Author
Owner

@kickerofelves commented on GitHub (Nov 26, 2012):

If you have a directory with many (50+ e.g.) files, it is usually simpler and faster to just double click the filename than to rely on tab expansion. Now FiloSottile has eliminated underscores this is no longer possible.

"Every shell has its special characters, and a shell user needs to account for those by himself." Do you know how many times I've seen Windows users recommend youtube-dl to other Windows users? Never. This is a *nix world program and every major shell uses '&' for job control. (And I think it's a special concatenation character on Windows.) No one has said to "escape them all" but '&' is not some weird minor character.

I could just write a patch to revert to older, saner functionality but with the binary that is more difficult and the instructions at https://github.com/rg3/youtube-dl#what-is-this-binary-file-where-has-the-code-gone don't even work.

Finally, you closed the other issue I submitted https://github.com/rg3/youtube-dl/issues/547 before I could respond and said "I'm unsure over where to include that information." How about on the documentation page? http://rg3.github.com/youtube-dl/documentation.html Of course that page is still says yahoo video is supported so maybe it needs a lot of updating. Thanks for the ~/.config/youtube-dl.conf info.

@kickerofelves commented on GitHub (Nov 26, 2012): If you have a directory with many (50+ e.g.) files, it is usually simpler and faster to just double click the filename than to rely on tab expansion. Now FiloSottile has eliminated underscores this is no longer possible. "Every shell has its special characters, and a shell user needs to account for those by himself." Do you know how many times I've seen Windows users recommend youtube-dl to other Windows users? Never. This is a *nix world program and every major shell uses '&' for job control. (And I think it's a special concatenation character on Windows.) No one has said to "escape them all" but '&' is not some weird minor character. I could just write a patch to revert to older, saner functionality but with the binary that is more difficult and the instructions at https://github.com/rg3/youtube-dl#what-is-this-binary-file-where-has-the-code-gone don't even work. Finally, you closed the other issue I submitted https://github.com/rg3/youtube-dl/issues/547 before I could respond and said "I'm unsure over where to include that information." How about on the documentation page? http://rg3.github.com/youtube-dl/documentation.html Of course that page is still says yahoo video is supported so maybe it needs a lot of updating. Thanks for the `~/.config/youtube-dl.conf` info.
Author
Owner

@FiloSottile commented on GitHub (Nov 26, 2012):

If you have a directory with many (50+ e.g.) files, it is usually simpler and faster to just double click the filename than to rely on tab expansion. Now FiloSottile has eliminated underscores this is no longer possible.

Sorry, I don't get the double-clicking thing. Also, do you mean that we don't replace amps or spaces or what with underscores?

"Every shell has its special characters, and a shell user needs to account for those by himself." Do you know how many times I've seen Windows users recommend youtube-dl to other Windows users? Never.

Do you know who wrote me last week? www.easybrakeconverter.com (http://www.easybrakeconverter.com/)
And this is the only I can disclose, as I asked for permission, but scrape a bit the bug tracker.

This is a *nix world program and every major shell uses '&' for job control. (And I think it's a special concatenation character on Windows.) No one has said to "escape them all" but '&' is not some weird minor character.

!, ?, (, ), ", ' and space will all be deadly to my shell, if unescaped.

I could just write a patch to revert to older, saner functionality but with the binary that is more difficult and the instructions at https://github.com/rg3/youtube-dl#what-is-this-binary-file-where-has-the-code-gone don't even work.

Please, detail what you mean by "saner" functionality. If the community and the other developers appreciate it, I'll implement it myself.
Also, the code is only a folder away (there are three folders in the repo) and the FAQ is only off by "make compile" -> "make youtube-dl". Fixed.

Finally, you closed the other issue I submitted #547 (https://github.com/rg3/youtube-dl/issues/547) before I could respond and said "I'm unsure over where to include that information." How about on the documentation page? http://rg3.github.com/youtube-dl/documentation.html Of course that page is still says yahoo video is supported so maybe it needs a lot of updating. Thanks for the ~/.config/youtube-dl.conf info.

Yes. We need to update documentation. And you can comment on closed issues. And reopen them, if there's anything left.

Now, please be positive and constructive, and keep the atmosphere relaxed (better than I'm doing ATM) because I also have history to study, and phihag has a thesis ongoing, and we are here only to help.

@FiloSottile commented on GitHub (Nov 26, 2012): > If you have a directory with many (50+ e.g.) files, it is usually simpler and faster to just double click the filename than to rely on tab expansion. Now FiloSottile has eliminated underscores this is no longer possible. Sorry, I don't get the double-clicking thing. Also, do you mean that we don't replace amps or spaces or what with underscores? > "Every shell has its special characters, and a shell user needs to account for those by himself." Do you know how many times I've seen Windows users recommend youtube-dl to other Windows users? Never. Do you know who wrote me last week? www.easybrakeconverter.com (http://www.easybrakeconverter.com/) And this is the only I can disclose, as I asked for permission, but scrape a bit the bug tracker. > This is a *nix world program and every major shell uses '&' for job control. (And I think it's a special concatenation character on Windows.) No one has said to "escape them all" but '&' is not some weird minor character. !, ?, (, ), ", ' and space will all be deadly to my shell, if unescaped. > I could just write a patch to revert to older, saner functionality but with the binary that is more difficult and the instructions at https://github.com/rg3/youtube-dl#what-is-this-binary-file-where-has-the-code-gone don't even work. Please, detail what you mean by "saner" functionality. If the community and the other developers appreciate it, I'll implement it myself. Also, the code is only a folder away (there are three folders in the repo) and the FAQ is only off by "make compile" -> "make youtube-dl". Fixed. > Finally, you closed the other issue I submitted #547 (https://github.com/rg3/youtube-dl/issues/547) before I could respond and said "I'm unsure over where to include that information." How about on the documentation page? http://rg3.github.com/youtube-dl/documentation.html Of course that page is still says yahoo video is supported so maybe it needs a lot of updating. Thanks for the ~/.config/youtube-dl.conf info. Yes. We need to update documentation. And you can comment on closed issues. And reopen them, if there's anything left. Now, please be positive and constructive, and keep the atmosphere relaxed (better than I'm doing ATM) because I also have history to study, and phihag has a thesis ongoing, and we are here only to help.
Author
Owner

@FiloSottile commented on GitHub (Nov 26, 2012):

Oh, wait, got it. Double-clicking to select the text. I fear that there are a number of similar breaking characters, space first. I think this is a beauty-usability tradeoff. I'm for --id -> usability and --title -> (working) beauty.

@FiloSottile commented on GitHub (Nov 26, 2012): Oh, wait, got it. Double-clicking to select the text. I fear that there are a number of similar breaking characters, space first. I think this is a beauty-usability tradeoff. I'm for `--id -> usability` and `--title -> (working) beauty`.
Author
Owner

@rg3 commented on GitHub (Nov 26, 2012):

In an xterm-like terminal, characters are sorted in classes. When you double-click on a character, it selects the full group of neighbour characters that belong to the same class as the one you clicked on. This is explained in the "CHARACTER CLASSES" section of the xterm manpage.

Fortunately, you can change the character class of the ampersand character to make it belong to the letters class. Is this an appropriate solution for the OP problem?

@rg3 commented on GitHub (Nov 26, 2012): In an xterm-like terminal, characters are sorted in classes. When you double-click on a character, it selects the full group of neighbour characters that belong to the same class as the one you clicked on. This is explained in the "CHARACTER CLASSES" section of the xterm manpage. Fortunately, you can change the character class of the ampersand character to make it belong to the letters class. Is this an appropriate solution for the OP problem?
Author
Owner

@phihag commented on GitHub (Nov 26, 2012):

@kickerofelves As @FiloSottile said, just because #547 is closed doesn't mean that you cannot comment or reopen it. I just got the impression that using the configuration file would almost certainly solve your problem. Please discuss everything related to that issue there. Thanks!

Also note that the binary version has no effect on development - in fact, it makes it easier since we now can split the code across multiple files. The following instruction (copied from the FAQ should work:

git clone git://github.com/rg3/youtube-dl.git
cd youtube-dl
python -m youtube_dl --help

If it doesn't, please file an issue with details on what doesn't work. So feel free to submit patches to the youtube_dl/* files.


I believe the new --restrict-filenames option in youtube-dl 2012.11.27 solves your problem. As mentioned above, you can add it to /etc/youtube-dl.conf to make it the default, or simply create a shell alias. If it doesn't, feel free to comment here and reopen this issue, or simply open a new issue. Thank you for reporting issues with youtube-dl!

@phihag commented on GitHub (Nov 26, 2012): @kickerofelves As @FiloSottile said, just because #547 is closed doesn't mean that you cannot comment or reopen it. I just got the impression that using the configuration file would almost certainly solve your problem. Please discuss everything related to that issue there. Thanks! Also note that the binary version has no effect on development - in fact, it makes it easier since we now can split the code across multiple files. The following instruction (copied from the [FAQ](https://github.com/rg3/youtube-dl#syntaxerror-non-ascii-character) should work: ``` git clone git://github.com/rg3/youtube-dl.git cd youtube-dl python -m youtube_dl --help ``` If it doesn't, please file an issue with details on what doesn't work. So feel free to submit patches to the `youtube_dl/*` files. --- I believe the new `--restrict-filenames` option in youtube-dl 2012.11.27 solves your problem. As mentioned above, you can add it to `/etc/youtube-dl.conf` to make it the default, or simply create a shell alias. If it doesn't, **feel free to comment here and reopen this issue**, or simply open a new issue. Thank you for reporting issues with youtube-dl!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#400
No description provided.