mirror of
				https://gitlab.com/ytdl-org/youtube-dl.git
				synced 2025-11-04 10:27:07 -05:00 
			
		
		
		
	[xattr] Write bytestrings, not characters
This commit is contained in:
		@@ -5,6 +5,7 @@ import sys
 | 
				
			|||||||
from .common import PostProcessor
 | 
					from .common import PostProcessor
 | 
				
			||||||
from ..utils import (
 | 
					from ..utils import (
 | 
				
			||||||
    hyphenate_date,
 | 
					    hyphenate_date,
 | 
				
			||||||
 | 
					    preferredencoding,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -70,7 +71,7 @@ class XAttrMetadataPP(PostProcessor):
 | 
				
			|||||||
                                    e = OSError(potential_errno, potential_errorstr)
 | 
					                                    e = OSError(potential_errno, potential_errorstr)
 | 
				
			||||||
                                    e.__cause__ = None
 | 
					                                    e.__cause__ = None
 | 
				
			||||||
                                    raise e
 | 
					                                    raise e
 | 
				
			||||||
                            raise # Reraise unhandled error
 | 
					                            raise  # Reraise unhandled error
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    # On Unix, and can't find pyxattr, setfattr, or xattr.
 | 
					                    # On Unix, and can't find pyxattr, setfattr, or xattr.
 | 
				
			||||||
@@ -113,7 +114,8 @@ class XAttrMetadataPP(PostProcessor):
 | 
				
			|||||||
                    if infoname == "upload_date":
 | 
					                    if infoname == "upload_date":
 | 
				
			||||||
                        value = hyphenate_date(value)
 | 
					                        value = hyphenate_date(value)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    write_xattr(filename, xattrname, value)
 | 
					                    byte_value = value.encode(preferredencoding())
 | 
				
			||||||
 | 
					                    write_xattr(filename, xattrname, byte_value)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return True, info
 | 
					            return True, info
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user