1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 04:23:01 +00:00

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

@ -29,6 +29,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Fix crash when using the search bar with PHP 8.0+ - Fix crash when using the search bar with PHP 8.0+
- Prefix the default value of the `logo_url` setting with `https:` - 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 ## v0.22

View file

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