Message132288
I looked at the existing patches - and noted that they went closer to how Windows does short files - but still left out some cases.
I believe the latest patch catches all cases.
from http://msdn.microsoft.com/en-us/library/aa368590(v=vs.85).aspx
Short and long file names must not contain the following characters:
slash (/) or (\)
question mark (?)
vertical bar (|)
right angle bracket (>)
left angle bracket (<)
colon (:)
asterisk (*)
quotation mark (")
In addition, short file names must not contain the following characters:
plus sign (+)
comma (,)
semicolon (;)
equals sign (=)
left square bracket ([)
right square bracket (])
No space is allowed preceding the vertical bar (|) separator for the short file name/long file name syntax. Short file names may not include a space, although a long file name may. A space can exist after the separator only if the long file name of the file name begins with the space. No full-path syntax is allowed.
Though I wonder do we really need to check for or replace the first set of characters above - none are allowed in any file name, so if they are there it is probably a error in how the function was called!
I also tested speed of re.sub, comprehension ("".join(c for c in ...) and for loops - and for loops were the fasted (for the small set of characters being replaced).
I am not patching make_id() - because I have added a patch for that to issue2694.
Note - The attached patch will probably not apply cleanly - as it pre-supposes that the patch (http://bugs.python.org/file21408/make_id_fix_and_test.patch) from issue2694 is applied first (especially for the tests) |
|
Date |
User |
Action |
Args |
2011-03-27 04:13:24 | markm | set | recipients:
+ markm, loewis, amaury.forgeotdarc, atuining, janssen, tim.golden, brian.curtin, hnrqbaggio, cgohlke, BreamoreBoy |
2011-03-27 04:13:24 | markm | set | messageid: <1301199204.67.0.430903527903.issue1128@psf.upfronthosting.co.za> |
2011-03-27 04:13:24 | markm | link | issue1128 messages |
2011-03-27 04:13:23 | markm | create | |
|