diff options
author | Scott Dutton <scott@exussum.co.uk> | 2016-02-03 05:45:24 +0000 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2016-02-03 11:26:32 +0100 |
commit | 49dd9f021924551bf0cfc5db3962ddb50c9e98a2 (patch) | |
tree | a74113d7d359da6b71c4f737fc15ed488b4ea733 | |
parent | cec63974c393b71770eae7d740e136b43ed1c78f (diff) | |
download | forums-49dd9f021924551bf0cfc5db3962ddb50c9e98a2.tar forums-49dd9f021924551bf0cfc5db3962ddb50c9e98a2.tar.gz forums-49dd9f021924551bf0cfc5db3962ddb50c9e98a2.tar.bz2 forums-49dd9f021924551bf0cfc5db3962ddb50c9e98a2.tar.xz forums-49dd9f021924551bf0cfc5db3962ddb50c9e98a2.zip |
[ticket/14431] Remote avatar uploading
Fixed content length bug
Ran composer update
PHPBB3-14431
-rw-r--r-- | phpBB/phpbb/files/types/remote.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/phpBB/phpbb/files/types/remote.php b/phpBB/phpbb/files/types/remote.php index e990149501..92e0e3b9bc 100644 --- a/phpBB/phpbb/files/types/remote.php +++ b/phpBB/phpbb/files/types/remote.php @@ -115,13 +115,19 @@ class remote extends base return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'NOT_UPLOADED')); } - if ($remote_max_filesize && $response->getContentType() > $remote_max_filesize) + $content_length = $response->getContentLength(); + if ($remote_max_filesize && $content_length > $remote_max_filesize) { $max_filesize = get_formatted_filesize($remote_max_filesize, false); return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit'])); } + if ($content_length == 0) + { + return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'EMPTY_REMOTE_DATA'); + } + $data = $response->getBody(); $filename = tempnam(sys_get_temp_dir(), unique_id() . '-'); |