Closed AlanRitchie closed 7 years ago
ok, I found what is the problem here. Sorry for this, I should have documented it in the readme. I made a change in the SDK and reported the issue to the team at Autodesk which maintains it.
After npm install, go to /node_modules/forge-apis/src/ https://github.com/Autodesk-Forge/forge-api-nodejs-client/blob/master/src/ApiClient.js#L350 and change code like this:
if (accepts.length > 0) {
headers['Accept'] = accepts.join(',');
for ( var i =0 ; i < accepts.length ; i++ ) {
if ( accepts [i] === 'application/octet-stream' )
requestParams.encoding = null;
}
}
if ( headerParams ['Accept-Encoding'] == 'gzip, deflate' )
requestParams.encoding = null;
_this.debug('request params were', requestParams);
again sorry to have missed this one in the readme. I assumed the SDK team would have made the fix in time.
-cyrille
The downloaded thumbnails don't appear to be valid PNG files. I think the first problem is that they are being saved as UTF-8, with a BOM before the start of the file. But looking at result.js downloadThumbnail, the first character in the thumbnail body appears to be 0xfffd (unicode replacement character), not 0x89. So there is another conversion to unicode before the response body is being saved as a file.