Skip to content

Commit 14bc74d

Browse files
committed
better distinguish URL schemes and windows drive letters
1 parent cb0be79 commit 14bc74d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/Symfony/Component/Filesystem/Path.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public static function isAbsolute(string $path): bool
368368
}
369369

370370
// Strip scheme
371-
if (false !== $schemeSeparatorPosition = strpos($path, '://')) {
371+
if ((false !== $schemeSeparatorPosition = strpos($path, '://')) && !preg_match('#^[A-Z]://#', $path)) {
372372
$path = substr($path, $schemeSeparatorPosition + 3);
373373
}
374374

src/Symfony/Component/Filesystem/Tests/PathTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ public static function provideIsAbsolutePathTests(): \Generator
375375

376376
yield ['C:/css/style.css', true];
377377
yield ['D:/', true];
378+
yield ['C:///windows', true];
379+
yield ['C://test', true];
378380

379381
yield ['E:\\css\\style.css', true];
380382
yield ['F:\\', true];

0 commit comments

Comments
 (0)