mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
prevent a bug preventing .mobileconfig uploads in Linux/Windows (#14716)
For #14056, per the [mdn web docs](https://developer.mozilla.org/en-US/docs/Web/API/File/type) > Note: Based on the current implementation, browsers won't actually > read the bytestream of a file to determine its media type. It is assumed > based on the file extension; a PNG image file renamed to .txt would give > "text/plain" and not "image/png". Moreover, file.type is generally > reliable only for common file types like images, HTML documents, audio > and video. Uncommon file extensions would return an empty string. Client > configuration (for instance, the Windows Registry) may result in > unexpected values even for common types. Developers are advised not to > rely on this property as a sole validation scheme.
This commit is contained in:
parent
001120274c
commit
3869b41041
2 changed files with 4 additions and 1 deletions
1
changes/14056-file-ext
Normal file
1
changes/14056-file-ext
Normal file
|
|
@ -0,0 +1 @@
|
|||
* Fixed a bug preventing Windows and Linux users to upload .mobileconfig files in the UI.
|
||||
|
|
@ -61,7 +61,9 @@ const CustomSettings = ({
|
|||
const file = files[0];
|
||||
|
||||
if (
|
||||
file.type !== "application/x-apple-aspen-config" ||
|
||||
// file.type might be empty on some systems as uncommon file extensions
|
||||
// would return an empty string.
|
||||
(file.type !== "" && file.type !== "application/x-apple-aspen-config") ||
|
||||
!file.name.includes(".mobileconfig")
|
||||
) {
|
||||
renderFlash("error", UPLOAD_ERROR_MESSAGES.wrongType.message);
|
||||
|
|
|
|||
Loading…
Reference in a new issue