Show More
@@ -143,25 +143,26 b' def _auxencode(path, dotencode):' | |||||
143 | ''' |
|
143 | ''' | |
144 | res = path.split('/') |
|
144 | res = path.split('/') | |
145 | for i, n in enumerate(res): |
|
145 | for i, n in enumerate(res): | |
146 | if n: |
|
146 | if not n: | |
147 | if dotencode and n[0] in '. ': |
|
147 | continue | |
148 | n = "~%02x" % ord(n[0]) + n[1:] |
|
148 | if dotencode and n[0] in '. ': | |
|
149 | n = "~%02x" % ord(n[0]) + n[1:] | |||
|
150 | res[i] = n | |||
|
151 | else: | |||
|
152 | l = n.find('.') | |||
|
153 | if l == -1: | |||
|
154 | l = len(n) | |||
|
155 | if ((l == 3 and n[:3] in _winres3) or | |||
|
156 | (l == 4 and n[3] <= '9' and n[3] >= '1' | |||
|
157 | and n[:3] in _winres4)): | |||
|
158 | # encode third letter ('aux' -> 'au~78') | |||
|
159 | ec = "~%02x" % ord(n[2]) | |||
|
160 | n = n[0:2] + ec + n[3:] | |||
149 | res[i] = n |
|
161 | res[i] = n | |
150 |
|
|
162 | if n[-1] in '. ': | |
151 | l = n.find('.') |
|
163 | # encode last period or space ('foo...' -> 'foo..~2e') | |
152 | if l == -1: |
|
164 | n = n[:-1] + "~%02x" % ord(n[-1]) | |
153 |
|
|
165 | res[i] = n | |
154 | if ((l == 3 and n[:3] in _winres3) or |
|
|||
155 | (l == 4 and n[3] <= '9' and n[3] >= '1' |
|
|||
156 | and n[:3] in _winres4)): |
|
|||
157 | # encode third letter ('aux' -> 'au~78') |
|
|||
158 | ec = "~%02x" % ord(n[2]) |
|
|||
159 | n = n[0:2] + ec + n[3:] |
|
|||
160 | res[i] = n |
|
|||
161 | if n[-1] in '. ': |
|
|||
162 | # encode last period or space ('foo...' -> 'foo..~2e') |
|
|||
163 | n = n[:-1] + "~%02x" % ord(n[-1]) |
|
|||
164 | res[i] = n |
|
|||
165 | return '/'.join(res) |
|
166 | return '/'.join(res) | |
166 |
|
167 | |||
167 | _maxstorepathlen = 120 |
|
168 | _maxstorepathlen = 120 |
General Comments 0
You need to be logged in to leave comments.
Login now