Prevent copying MacOS hidden files

pull/16/head
Dan Puttick 2017-07-17 10:22:46 -04:00
parent 5aaeac6f16
commit 0c35885f17
1 changed files with 9 additions and 5 deletions

View File

@ -214,14 +214,18 @@ class File(FileBase):
If the filename contains any dangerous or specific characters, handle If the filename contains any dangerous or specific characters, handle
them appropriately. them appropriately.
""" """
if self.filename[0] is '.': if self.filename.startswith('.'):
# TODO: handle dotfiles here macos_hidden_files = set(
pass '.Trashes', '._.Trashes', '.DS_Store', '.fseventsd', '.Spotlight-V100'
)
if self.filename in macos_hidden_files:
self.add_description('MacOS hidden metadata file.')
self.should_copy = False
right_to_left_override = u"\u202E" right_to_left_override = u"\u202E"
if right_to_left_override in self.filename: if right_to_left_override in self.filename:
self.make_dangerous('Filename contains dangerous character') self.make_dangerous('Filename contains dangerous character')
self.filename = self.filename.replace(right_to_left_override, '') new_filename = self.filename.replace(right_to_left_override, '')
self.set_property('filename', self.filename) self.set_property('filename', new_filename)
def check(self): def check(self):
""" """