GMDprivateServer icon indicating copy to clipboard operation
GMDprivateServer copied to clipboard

SongAdd.php fails to reupload valid songs

Open Wyliemaster opened this issue 2 years ago • 0 comments

Title explains the issue enough. I did some debugging and identified that the issue is inside the getFileInfo method

	public function getFileInfo($url){
		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
		curl_setopt($ch, CURLOPT_HEADER, TRUE);
		//curl_setopt($ch, CURLOPT_NOBODY, TRUE);
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
		curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
		$data = curl_exec($ch);
		$size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
		$mime = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
		//$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
		curl_close($ch);
		return ['size' => $size, 'type' => $mime];
	}

The song does appear to return the content type image

however, the "type" which is returned from this function is empty

image

Wyliemaster avatar Apr 12 '23 20:04 Wyliemaster