Make WordPress Core

Opened 16 years ago

Closed 16 years ago

#430 closed defect (bug) (worksforme)

upload: incorrect duplicate name handling

Reported by: anonymousbugger Owned by: matt
Milestone: Priority: normal
Severity: minor Version: 1.5
Component: Administration Keywords:
Focuses: Cc:


In the file upload.php, there is a part that checks for duplicate filenames, and if so 'computes' a new name. What is the problem:
$filetype is the lowercased extension of the file, eg "jpg", but the real filename might be JPG. If this is the case, the line
$pos = strpos($tmppathtofile, '.'.trim($imgtype));
will return false.

The solution is
$pos = strpos(strtolower($tmppathtofile), '.'.trim($imgtype));

This all happens around line 115 of file upload.php in directory wp-admin.

Change History (6)

#2 @matt
16 years ago

  • Owner changed from anonymous to matt
  • Resolution changed from 10 to 20
  • Status changed from new to closed

#3 @matt
16 years ago

  • Patch set to No
  • Version changed from 1.2 to 1.5

#4 @anonymousbugger
16 years ago

  • Patch changed from No to Yes
  • Resolution changed from 20 to 30
  • Status changed from closed to assigned

#5 @anonymousbugger
16 years ago

This isn't the correct way to go about this; on *nix systems, filenames are case-sensitive. foo.jpg and foo.JPG are different files.

#6 @matt
16 years ago

  • Resolution changed from 30 to 40
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.