Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#43861 closed defect (bug) (invalid)

Administrator cannot upload .cpp file to mediafiles

Reported by: acbaile's profile acbaile Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:

Description

My account is first in installation and I see in the list of users that role is Administrator. But I cannot upload .cpp file. I see: "this file type is not permitted for security reasons". I cannot change it - I cannot find this setting on user page. So, why is it? And how to fix?

Change History (4)

#1 follow-ups: @desrosj
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 4.9.5 deleted

Hi @acbaile, thanks for the ticket!

.cpp files are not in the list of file types that WordPress allows to be uploaded by default.

There is no setting to enable this, but it could be allowed using the mime_types filter (https://core.trac.wordpress.org/browser/tags/4.9.5/src/wp-includes/functions.php#L2413).

Make sure you give proper consideration to the file type you are whitelisting, and who you are allowing to upload.

#2 in reply to: ↑ 1 @acbaile
7 years ago

Replying to desrosj:

.cpp files are not in the list of file types that WordPress allows to be uploaded by default.
There is no setting to enable this,

Why? I see in the code following parts of code:

case 'unfiltered_upload':

current_user_can( 'unfiltered_upload' )

function populate_roles_230() {
	$role = get_role( 'administrator' );

	if ( !empty( $role ) ) {
		$role->add_cap( 'unfiltered_upload' );
	}
}

It seems, this function was present in the past. Why did this possibility disappear?

It is inconvenience.

#3 in reply to: ↑ 1 @acbaile
7 years ago

Replying to desrosj:

.cpp files are not in the list of file types that WordPress allows to be uploaded by default.

Why? I see between mime_types:

// Text formats.
'txt|asc|c|cc|h|srt' => 'text/plain',

Is "cpp" so different from "c"?

#4 in reply to: ↑ 1 @acbaile
7 years ago

Replying to desrosj:

.cpp files are not in the list of file types that WordPress allows to be uploaded by default.

Adding resolves my problem. Can you add this file type to the list?

Last edited 7 years ago by acbaile (previous) (diff)
Note: See TracTickets for help on using tickets.