[issue43607] urllib's request.pathname2url not compatible with extended-length Windows file paths

2021-03-23 Thread D Levine


New submission from D Levine :

Windows file paths are limited to 256 characters, and one of Windows's 
prescribed methods to address this is to prepend "\\?\" before a Windows 
absolute path (see: 
https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation)

urllib.request.pathname2url raises an error on such paths as this function 
calls nturl2path.py's pathname2url function which explicitly checks that the 
number of characters before the ":" in a Windows path is precisely one, which 
is, of course, not the case if you are using an extended-length path (e.g. 
"\\?\C:\Python39").

As a result, urllib cannot handle pathname2url conversion for some valid 
Windows paths.

--
components: Windows
messages: 389415
nosy: levineds, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: urllib's request.pathname2url not compatible with extended-length 
Windows file paths
type: crash
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue43607>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43607] urllib's request.pathname2url not compatible with extended-length Windows file paths

2021-03-23 Thread D Levine


Change by D Levine :


--
type: crash -> behavior

___
Python tracker 
<https://bugs.python.org/issue43607>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43607] urllib's request.pathname2url not compatible with extended-length Windows file paths

2021-03-23 Thread D Levine


D Levine  added the comment:

I really meant 255 characters not 256 because I was leaving three for ":/". I suppose the most reasonable behavior is to strip out the "\\?\" 
before attempting the conversion as the path is sensible and parsable without 
that, as opposed to the current behavior which is to  crash. The practical 
benefit is to permit the function to work on a wider range of inputs than 
currently is possible for essentially no cost.

--

___
Python tracker 
<https://bugs.python.org/issue43607>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43607] urllib's request.pathname2url not compatible with extended-length Windows file paths

2021-03-23 Thread D Levine


D Levine  added the comment:

I think that would make the most sense, yes.

--

___
Python tracker 
<https://bugs.python.org/issue43607>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com