Make WordPress Core


Ignore:
Timestamp:
08/23/2022 07:57:17 PM (4 years ago)
Author:
antpb
Message:

Media: Account for Windows when normalizing file paths.
Previously, Windows paths in the path_is_absolute function resulted in incorrect URIs. This patch adjusts for forward slashes and adds tests for the get_attached_file function.
Props Whissi, SergeyBiryukov, desrosj, stevenlinx, birgire, davidbaumwald, costdev, peterwilsoncc, audrasjb, hellofromTonya, johnbillion.
Fixes #36308.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions.php

    r53890 r53934  
    106106                        'C:\\WINDOWS',
    107107                        '\\\\sambashare\\foo',
     108                        'c:/',
     109                        'c://',
     110                        '//',
     111                        'c:/FOO',
     112                        '//FOO',
     113                        'C:/WWW/Sites/demo/htdocs/wordpress/wp-content/uploads/2016/03/example.jpg',
     114                        '//ComputerName/ShareName/SubfolderName/example.txt',
    108115                );
    109116                foreach ( $absolute_paths as $path ) {
    … …  
    120127                        '../',
    121128                        '../foo.bar',
     129                        'foo.bar',
    122130                        'foo/bar',
    123131                        'foo',
    124132                        'FOO',
    125133                        '..\\WINDOWS',
     134                        '..//WINDOWS',
     135                        'c:',
     136                        'C:',
    126137                );
    127138                foreach ( $relative_paths as $path ) {
Note: See TracChangeset for help on using the changeset viewer.