Opened 5 years ago
Last modified 11 months ago
#49483 new enhancement
'Upload file types' Setting field for multisite network settings should be textarea than text input
Reported by: | shamalisulakhe | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.3.2 |
Component: | Administration | Keywords: | has-patch has-screenshots |
Focuses: | ui, multisite | Cc: |
Description
The setting field 'Upload file types' (CSS name='upload_filetypes') is currently a text input with visible width of 45 characters.
However, the default content of that field is 135 characters. Thus, it would be good to have it in the form of textarea to have a better look at all the content without the need for scrolling.
Steps to find -
- At a multisite WordPress installation, go to My Sites -> Network Admin -> Settings.
- Find the setting under the heading 'Upload Settings' with label 'Upload file types'.
- The default value in that field is as follows -
jpg jpeg png gif mov avi mpg 3gp 3g2 midi mid pdf doc ppt odt pptx docx pps ppsx xls xlsx key mp3 ogg flac m4a wav mp4 m4v webm ogv flv
Screenshots -
- Current (with input tag) - upload_filetypes_current.png
- Proposed (with textarea tag) - upload_filetypes_proposed.png
Attachments (5)
Change History (12)
This ticket was mentioned in PR #159 on WordPress/wordpress-develop by shamalisulakhe.
5 years ago
#1
shamalisulakhe commented on PR #159:
5 years ago
#2
![upload_filetypes_proposed](https://user-images.githubusercontent.com/38684563/74945040-0ac9bf00-541d-11ea-956b-76caa7c19f12.png)
![upload_filetypes_current](https://user-images.githubusercontent.com/38684563/74945044-0c938280-541d-11ea-8195-988dbe9e0ec6.png)
#3
@
5 years ago
URL to find this field at a multisite installation -
{site_url}/wp-admin/network/settings.php
#4
@
5 years ago
I do like this change.
It will introduce the ability for users to separate file types on new lines, not just spaces anymore.
The way this setting gets parsed should be tested to ensure that both new lines and spaces work the same.
#5
@
5 years ago
@johnjamesjacoby
I agree with your point.
I checked and found that new lines do not work as per current way of parsing the setting, so changed the parsing code to allow new lines as well as spaces. This has one more benefit that multiple spaces between two strings are also allowed.
Revised patch - upload_filetypes-textarea-49483.diff
#6
@
5 years ago
@johnjamesjacoby
I have noticed a few more things -
- If the filetypes are entered in upper case characters (such as ODT, WebM instead of odt, webm), they are not recognized and therefore allowed for media uploads.
- The user may enter the filetype in the form of an extension (such as .jpg instead of jpg), they are also not allowed.
In such cases, we should convert the filetypes to lowercases and remove periods(.) before saving them to site options. I have added these conversions in the revised patch-2.
Another concern is that -
I have added these modified conversion and parsing functionality in the function check_upload_mimes(), which is the only function in WP core where the site option upload_filetypes is fetched.
Thus, it is expected that the third-party plugins and themes use check_upload_mimes() function, instead of fetching the site option upload_filetypes directly in their code.
Revised patch - upload_filetypes-textarea-49483-2.diff
Current structure with input tag