[wp-trac] [WordPress Trac] #51368: Remove windows path check from validate_file

WordPress Trac noreply at wordpress.org
Tue Sep 22 21:51:05 UTC 2020


#51368: Remove windows path check from validate_file
----------------------------+------------------------------
 Reporter:  zieladam        |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Filesystem API  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+------------------------------

Comment (by zieladam):

 @whyisjake

 The hard part here is that not only are all of these are valid paths on
 windows:


 {{{

 C:Projects\apilibrary\apilibrary.sln
 D:\FY2018
 \\system07\C$\
 \Server2\Share\Test\Foo.txt
 c:\temp\test-file.txt
 \\127.0.0.1\c$\temp\test-file.txt
 \\LOCALHOST\c$\temp\test-file.txt
 \\.\c:\temp\test-file.txt
 \\?\c:\temp\test-file.txt
 \\.\UNC\LOCALHOST\c$\temp\test-file.txt
 \\127.0.0.1\c$\temp\test-file.txt
 \?\Volume{b75e2c83-0000-0000-0000-602f00000000}\Test\Foo.txt

 }}}

 But also that:

 > On Windows, both slash (/) and backslash (\) are used as directory
 separator character. In other environments, it is the forward slash (/).
 > – PHP docs https://www.php.net/manual/en/function.basename.php

 In this context, these are valid paths on both windows and linux:

 {{{

 //system07/C$/
 //./c:/temp/test-file.txt
 //LOCALHOST/c$/temp/test-file.txt

 }}}

 This one is either absolute or relative depending on the context:
 `C:Projects/apilibrary/apilibrary.sln`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51368#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list