Squash a warning when uploading a file

This commit is contained in:
Starbeamrainbowlabs 2019-06-01 19:57:03 +01:00
parent 712e95474c
commit a5572bcbd4
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
2 changed files with 3 additions and 2 deletions

View File

@ -12,6 +12,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Consolidated `email` and `emailAddress` fields into the latter in the user table (#167)
- Fixed a crash when trying to access the user table when not logged in as an administrator.
- Fixed help text for the file upload module
- Squashed a warning when uploading a file
### Added
- [Module API] Added new extra data system. See `parser-parsedown` and `page-edit` for an example.

View File

@ -1,7 +1,7 @@
<?php
register_module([
"name" => "Uploader",
"version" => "0.5.16",
"version" => "0.5.17",
"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",
@ -108,7 +108,7 @@ register_module([
// Make sure uploads are enabled
if(!$settings->upload_enabled)
{
if(!empty($_FILES["file"]))
if(!empty($_FILES["file"]) && file_exists($_FILES["file"]["tmp_name"]))
unlink($_FILES["file"]["tmp_name"]);
http_response_code(412);
exit(page_renderer::render("Upload failed - $settings->sitename", "<p>Your upload couldn't be processed because uploads are currently disabled on $settings->sitename. <a href='index.php'>Go back to the main page</a>.</p>"));