Merge pull request #39 from harshvardhanmalpani/patch-1

removes Query string from img url to get file name
pull/58/head
Rodolfo Berrios 2019-09-30 14:55:56 -03:00 committed by GitHub
commit 599d35cec2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -92,7 +92,7 @@ class Upload {
}
// Save the source name
$this->source_name = G\get_filename_without_extension($this->type == "url" ? $this->source : $this->source["name"]);
$this->source_name = G\get_filename_without_extension($this->type == "url" ? $this->getNameFromURL($this->source) : $this->source["name"]);
// Set file extension
$this->extension = $this->source_image_fileinfo["extension"];
@ -184,6 +184,16 @@ class Upload {
return explode(',', $formats);
}
//remove query string from url to get correct image name
protected function getNameFromURL()
{
if(strpos($this->source, '?')) {
return substr($this->source, 0, strpos($this->source, '?'));
} else {
return $this->source;
}
}
// Failover since v3.8.12
public static function getEnabledImageFormats() {
return Image::getEnabledImageFormats();

View File

@ -318,7 +318,7 @@ class DB {
$query = 'SELECT * FROM '.$table;
if($join) {
if(isset($join) && $join) {
$query .= ' ' . $join . ' ';
}