File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55## [ Unreleased]
66### Added
77- This CHANGELOG file.
8+ - Handle misconfigured password and destination folder.
89
910### Changed
1011- Handle duplicate files in the same way as the Python implementation, adding
Original file line number Diff line number Diff line change 5757 exit ();
5858}
5959
60+ /**
61+ * Double check if a password has been configured. If there has not and we are
62+ * testing the server, exit with HTTP code 401. Otherwise treat it as an empty
63+ * string.
64+ */
65+ if (!isset ($ Password ) || !is_string ($ Password )) {
66+ if ($ testing ) {
67+ header ($ protocol . ' 401 Unauthorized ' );
68+ exit ();
69+ }
70+ $ Password = '' ;
71+ }
72+
6073/**
6174 * If the client did not submit a password, or the submitted password did not
6275 * match this server's password, exit with HTTP code 403.
7083}
7184
7285/**
73- * If the upload destination folder does not exist or is not writable by PHP,
74- * exit with HTTP code 500.
86+ * If the upload destination folder has not been configured, does not exist, or
87+ * is not writable by PHP, exit with HTTP code 500.
7588 */
7689if (
90+ !isset ($ MediaRoot ) ||
91+ !is_string ($ MediaRoot ) ||
7792 !file_exists ($ MediaRoot ) ||
7893 !is_dir ($ MediaRoot ) ||
7994 !is_writable ($ MediaRoot )
You can’t perform that action at this time.
0 commit comments