[ticket/14431] Remote avatar uploading

Fixed content length bug
Ran composer update

PHPBB3-14431
This commit is contained in:
Scott Dutton 2016-02-03 05:45:24 +00:00 committed by Marc Alexander
parent cec63974c3
commit 49dd9f0219

View file

@ -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() . '-');