mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-14 22:00:23 +00:00
Media: Replace consecutive periods in sanitize_file_name().
On some servers, consecutive periods in a filename can cause a 403 Forbidden response. This changeset replaces consecutive periods with a single period, and adds related unit tests. Props ArtZ91, costdev, SergeyBiryukov, arthurshlain, mukesh27. Fixes #57242. git-svn-id: https://develop.svn.wordpress.org/trunk@55209 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -258,7 +258,7 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
$this->assertSame( 'abcdefgh.png', wp_unique_filename( $testdir, 'abcdefg"h.png' ), 'File with quote failed' );
|
||||
|
||||
// Test crazy name (useful for regression tests).
|
||||
$this->assertSame( '12af34567890@..^_qwerty-fghjkl-zx.png', wp_unique_filename( $testdir, '12%af34567890#~!@#$..%^&*()|_+qwerty fgh`jkl zx<>?:"{}[]="\'/?.png' ), 'Failed crazy file name' );
|
||||
$this->assertSame( '12af34567890@.^_qwerty-fghjkl-zx.png', wp_unique_filename( $testdir, '12%af34567890#~!@#$..%^&*()|_+qwerty fgh`jkl zx<>?:"{}[]="\'/?.png' ), 'Failed crazy file name' );
|
||||
|
||||
// Test slashes in names.
|
||||
$this->assertSame( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\fg.png' ), 'Slash not removed' );
|
||||
|
||||
Reference in New Issue
Block a user