diff --git a/app/lib/classes/class.upload.php b/app/lib/classes/class.upload.php index 07c53fc..1ab1046 100644 --- a/app/lib/classes/class.upload.php +++ b/app/lib/classes/class.upload.php @@ -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"]; @@ -183,7 +183,17 @@ class Upload { $formats = Settings::get('upload_available_image_formats'); 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(); diff --git a/lib/G/classes/class.db.php b/lib/G/classes/class.db.php index 93e97dc..14b31b5 100644 --- a/lib/G/classes/class.db.php +++ b/lib/G/classes/class.db.php @@ -318,7 +318,7 @@ class DB { $query = 'SELECT * FROM '.$table; - if($join) { + if(isset($join) && $join) { $query .= ' ' . $join . ' '; } @@ -544,4 +544,4 @@ class DB { } // DB class own Exception -class DBException extends Exception {} \ No newline at end of file +class DBException extends Exception {}