fix(NASA Node): Astronomy-Picture-Of-The-Day fails when it's YouTube video (#11046)

Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com>
This commit is contained in:
Ria Scholz 2024-10-08 14:22:39 +02:00 committed by GitHub
parent f124687b01
commit c70969da2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1069,7 +1069,7 @@ export class Nasa implements INodeType {
if (resource === 'astronomyPictureOfTheDay') { if (resource === 'astronomyPictureOfTheDay') {
download = this.getNodeParameter('download', 0); download = this.getNodeParameter('download', 0);
if (download) { if (download && responseData?.media_type === 'image') {
const binaryProperty = this.getNodeParameter('binaryPropertyName', i); const binaryProperty = this.getNodeParameter('binaryPropertyName', i);
const data = await nasaApiRequest.call( const data = await nasaApiRequest.call(
@ -1130,7 +1130,12 @@ export class Nasa implements INodeType {
if (resource === 'earthImagery' && operation === 'get') { if (resource === 'earthImagery' && operation === 'get') {
return [items]; return [items];
} else if (resource === 'astronomyPictureOfTheDay' && operation === 'get' && download) { } else if (
resource === 'astronomyPictureOfTheDay' &&
operation === 'get' &&
download &&
responseData?.media_type === 'image'
) {
return [items]; return [items];
} else { } else {
return [returnData]; return [returnData];