Skip to content
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

Fix title sanitation in windows #279

Closed
wants to merge 2 commits into from
Closed

Fix title sanitation in windows #279

wants to merge 2 commits into from

Conversation

Chronial
Copy link

This fixes the sanitation of titles for filenames in windows, which was broken (eg. multiple errors with this vid: http://www.youtube.com/watch?v=CT2rr0Otyto).

@MDCore
Copy link

MDCore commented May 23, 2012

I would find this very useful. I often have problems with the script creating semi-existent files because of non-windows-safe characters.

@Chronial
Copy link
Author

any comments on this?

@ssokolow
Copy link

To be 100% certain you're safe, I'd actually go a step further since, as I mentioned in issue #441, FAT (eg. thumbdrives) has some restrictions over and above those of Win32-compatible NTFS filenames.

(FAT can't have ASCII control characters in its filenames, so you should also filter for \x00-\x1f and \x7f)

@@ -197,7 +197,18 @@ def replace_insane(char):
if char in u' .\\/|?*<>:"' or ord(char) < 32:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As said in #500, here we should pull and.. (My fault)

@FiloSottile
Copy link
Collaborator

(see #500)

Actually, we already strip all those: (ok, let's add \x7f)

if char in u' .\\/|?*<>:"' or ord(char) < 32:

But I like the point of treating them differently, and of doing a pass of .strip('_') at the end.

@Chronial
Copy link
Author

Thanks for fixing this :)

@Chronial Chronial closed this Oct 28, 2012
joedborg referenced this pull request in joedborg/youtube-dl Nov 17, 2020
[pull] master from ytdl-org:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants