equal
deleted
inserted
replaced
512 "filename contains ':', which is reserved on Windows" |
512 "filename contains ':', which is reserved on Windows" |
513 >>> checkwinfilename("foo/bar/b\07la.txt") |
513 >>> checkwinfilename("foo/bar/b\07la.txt") |
514 "filename contains '\\\\x07', which is invalid on Windows" |
514 "filename contains '\\\\x07', which is invalid on Windows" |
515 >>> checkwinfilename("foo/bar/bla ") |
515 >>> checkwinfilename("foo/bar/bla ") |
516 "filename ends with ' ', which is not allowed on Windows" |
516 "filename ends with ' ', which is not allowed on Windows" |
|
517 >>> checkwinfilename("../bar") |
517 ''' |
518 ''' |
518 for n in path.replace('\\', '/').split('/'): |
519 for n in path.replace('\\', '/').split('/'): |
519 if not n: |
520 if not n: |
520 continue |
521 continue |
521 for c in n: |
522 for c in n: |
528 base = n.split('.')[0] |
529 base = n.split('.')[0] |
529 if base and base.lower() in _winreservednames: |
530 if base and base.lower() in _winreservednames: |
530 return _("filename contains '%s', which is reserved " |
531 return _("filename contains '%s', which is reserved " |
531 "on Windows") % base |
532 "on Windows") % base |
532 t = n[-1] |
533 t = n[-1] |
533 if t in '. ': |
534 if t in '. ' and n not in '..': |
534 return _("filename ends with '%s', which is not allowed " |
535 return _("filename ends with '%s', which is not allowed " |
535 "on Windows") % t |
536 "on Windows") % t |
536 |
537 |
537 if os.name == 'nt': |
538 if os.name == 'nt': |
538 checkosfilename = checkwinfilename |
539 checkosfilename = checkwinfilename |