Make WordPress Core

Opened 12 months ago

Last modified 12 months ago

#58513 new defect (bug)

Uploading JSON file of 1MB or less fails to upload

Reported by: oliwardgmailcom's profile oliward@… Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.2.2
Component: Upload Keywords:
Focuses: Cc:

Description

When uploading a JSON file of exactly 1048577 bytes or less leads to:

{filename} has failed to upload.
Sorry, you are not allowed to upload this file type.

Even though the file type is allowed. Tested with JSON file of valid JSON of 1048578 bytes (success) and 1048577 byes (failure).

Attachments (2)

more-than-1mb.json (1.0 MB) - added by oliward@… 12 months ago.
JSON file of arbitrary contents and size of more than 1 MB (1048578 bytes)
exactly-1mb.json (1.0 MB) - added by oliward@… 12 months ago.
JSON file of arbitrary contents and size of exactly 1 MB (1048577 bytes)

Change History (3)

@oliward@…
12 months ago

JSON file of arbitrary contents and size of more than 1 MB (1048578 bytes)

@oliward@…
12 months ago

JSON file of arbitrary contents and size of exactly 1 MB (1048577 bytes)

#1 in reply to: ↑ description @oliward@…
12 months ago

Replying to oliward@…:

Worth noting this was initially discovered on a multisite installation, but also tested on a fresh WP setup, non-multisite, after allowing JSON file upload with:

add_filter('upload_mimes', function ($mimes) {
    $mimes['json'] = 'text/plain';
    return $mimes;
});

When uploading a JSON file of exactly 1048577 bytes or less leads to:

{filename} has failed to upload.
Sorry, you are not allowed to upload this file type.

Even though the file type is allowed. Tested with JSON file of valid JSON of 1048578 bytes (success) and 1048577 byes (failure).

Last edited 12 months ago by oliward@… (previous) (diff)
Note: See TracTickets for help on using tickets.