Bugfix: fix error handling logic

This commit is contained in:
Starbeamrainbowlabs 2021-08-15 21:46:19 +01:00
parent ba70f74a96
commit fab1b52882
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
2 changed files with 4 additions and 3 deletions

View File

@ -28,7 +28,8 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Add `sidebar_show` to the settings GUI and the [configuration guide](https://starbeamrainbowlabs.com/labs/peppermint/peppermint-config-info.php)
- Fix crash when using the search bar with PHP 8.0+
- Prefix the default value of the `logo_url` setting with `https:`
- Fix display of subpages in the sidebar, and also wrap subpage lists in a `<details />` element to allow collapsing them
- Fix display of subpages in the sidebar, and also wrap subpage lists in a `<details />` element to allow collapsing them
- Fix file upload error handling logic - a proper error page is now sent to the client
## v0.22

View File

@ -5,7 +5,7 @@
register_module([
"name" => "Uploader",
"version" => "0.7.1",
"version" => "0.7.2",
"author" => "Starbeamrainbowlabs",
"description" => "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File/' prefix.",
"id" => "feature-upload",
@ -130,7 +130,7 @@ register_module([
// Check for php upload errors
if($_FILES["file"]["error"] > 0)
{
if(!empty($_FILES["file"]) && file_exists($_FILES["file"]))
if(!empty($_FILES["file"]) && !empty($_FILES["file"]["tmp_name"]) && file_exists($_FILES["file"]["tmp_name"]))
unlink($_FILES["file"]["tmp_name"]);
if($_FILES["file"]["error"] == 1 || $_FILES["file"]["error"] == 2)
http_response_code(413); // file is too large