I think its more likely gwtoolset looks at the mime type set in the Content-type header set by the webserver.
attempts to get the file extension of a media file url using the$options provided. it will first look for a valid file extension in theurl; if none is found it will fallback to an appropriate file extentionbased on the content-type