Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3df7b5a

Browse files
committed
Don't do truncation to 8+3 format -- this is used on NT file systems!
1 parent c75db0b commit 3df7b5a

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

Lib/ntpath.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ def expandvars(path):
312312

313313

314314
# Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A/B.
315-
# Also, components of the path are silently truncated to 8+3 notation.
315+
# Previously, this function also truncated pathnames to 8+3 format,
316+
# but as this module is called "ntpath", that's obviously wrong!
316317

317318
def normpath(path):
318319
path = normcase(path)
@@ -331,17 +332,9 @@ def normpath(path):
331332
i = i-1
332333
elif comps[i] == '' and i > 0 and comps[i-1] <> '':
333334
del comps[i]
334-
elif '.' in comps[i]:
335-
comp = string.splitfields(comps[i], '.')
336-
comps[i] = comp[0][:8] + '.' + comp[1][:3]
337-
i = i+1
338-
elif len(comps[i]) > 8:
339-
comps[i] = comps[i][:8]
340-
i = i+1
341335
else:
342336
i = i+1
343337
# If the path is now empty, substitute '.'
344338
if not prefix and not comps:
345339
comps.append('.')
346340
return prefix + string.joinfields(comps, os.sep)
347-

0 commit comments

Comments
 (0)