Cvolton / GMDprivateServer

Geometry Dash Private Server
GNU General Public License v3.0
397 stars 295 forks source link

SongAdd.php fails to reupload valid songs #999

Open Wyliemaster opened 1 year ago

Wyliemaster commented 1 year ago

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