comparison MoinMoin/action/AttachFile.py @ 3708:ce632fad1b03

AttachFile action: when unzipping member files, decode their filenames from utf-8 and replace invalid chars
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 12 Jun 2008 22:57:40 +0200
parents f0532fa90c6d
children b6dcdf55795e
comparison
equal deleted inserted replaced
3706:f0532fa90c6d 3708:ce632fad1b03
886 break 886 break
887 if zi.file_size >= request.cfg.unzip_single_file_size: # file too big 887 if zi.file_size >= request.cfg.unzip_single_file_size: # file too big
888 mapping = [] # zip is not acceptable 888 mapping = [] # zip is not acceptable
889 break 889 break
890 finalname = name[fname_index:] # remove common path prefix 890 finalname = name[fname_index:] # remove common path prefix
891 finalname = finalname.decode(config.charset, 'replace') # replaces trash with \uFFFD char
891 mapping.append((name, finalname)) 892 mapping.append((name, finalname))
892 new_fsizes[finalname] = zi.file_size 893 new_fsizes[finalname] = zi.file_size
893 894
894 # now we either have an empty mapping (if the zip is not acceptable), 895 # now we either have an empty mapping (if the zip is not acceptable),
895 # an identity mapping (no subdirs in zip, just all flat), or 896 # an identity mapping (no subdirs in zip, just all flat), or