Skip to content

Commit 513d7cb

Browse files
committed
Review
1 parent 9a50de7 commit 513d7cb

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Drivers/CurlDriver.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function exec($url, &$httpStatus, &$contentType, &$errorCode, &$errorMess
128128

129129
if ($code !== 0) {
130130
$errorCode = $code;
131-
$errorMessage = $this->errorMessage ? $this->errorMessage : ('cURL: ' . curl_error($ch));
131+
$errorMessage = $this->errorMessage ? $this->errorMessage : curl_error($ch);
132132

133133
if ($this->httpStatus !== null) {
134134
$httpStatus = $this->httpStatus;
@@ -146,6 +146,7 @@ public function exec($url, &$httpStatus, &$contentType, &$errorCode, &$errorMess
146146
private function abort($downloaded)
147147
{
148148
if ($downloaded > $this->maxDownloadSize) {
149+
$this->errorMessage = 'Download aborted because file size exceeded the maximum allowed';
149150
return 1;
150151
}
151152

src/Proxy.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ public function removeAllowedType($type)
246246
public function isAllowedType($type, &$errorMessage = null)
247247
{
248248
$type = trim($type);
249+
$pos = strpos($type, ';');
250+
251+
if ($pos > 0) {
252+
$type = substr($type, 0, $pos);
253+
}
249254

250255
if (array_key_exists($type, $this->allowedTypes)) {
251256
return true;
@@ -568,8 +573,7 @@ private function validateUrl($url)
568573
'\\|' => '|'
569574
));
570575

571-
$this->allowedUrlsRegEx = '#^(' . $regex . ')#';
572-
var_dump($this->allowedUrlsRegEx);
576+
$this->allowedUrlsRegEx = '#^(' . $regex . ')#i';
573577
}
574578

575579
if (!preg_match($this->allowedUrlsRegEx, $url)) {

0 commit comments

Comments
 (0)