added followsymlink

This commit is contained in:
Dooho Yi 2021-10-07 09:51:23 +09:00
parent 2df1976407
commit a59d6d1fc1

View file

@ -227,7 +227,7 @@ def distribusify(args, directory): # noqa
if args.latest_first: if args.latest_first:
reverse = True reverse = True
for root, dirs, files in os.walk(directory): for root, dirs, files in os.walk(directory, followlinks=True):
if args.exclude_directory: if args.exclude_directory:
if args.verbose: if args.verbose:
@ -255,6 +255,8 @@ def distribusify(args, directory): # noqa
if 'index.html' not in name: if 'index.html' not in name:
full_path = os.path.join(root, name) full_path = os.path.join(root, name)
#unfold all the symlinks, too
full_path = os.path.realpath(full_path)
mime = MIME_TYPE.from_file(full_path) mime = MIME_TYPE.from_file(full_path)
# example: MIME plain/text becomes 'type' plain 'subtype' text # example: MIME plain/text becomes 'type' plain 'subtype' text
type_, subtype = mime.split('/') type_, subtype = mime.split('/')