Incomplete meta for binary downloaded via Google Drive node

Hello! I am using the Google Drive node to find and download binary that should get attached to the email sent in the next step. However, the binary fetched has missing meta such as “File Name” and “File Extension”. The email attachment being sent is devoid of its original file name and extension. The recipient receives an “unknown” attachment.

This can be verified and compared using the examples below:

Problematic Google Drive fetched binary has only the “Mime Type”:

{
  "nodes": [
    {
      "parameters": {
        "fromEmail": "[email protected]",
        "toEmail": "[email protected]",
        "subject": "test",
        "text": "test attachment",
        "html": "test attachment",
        "attachments": "storehere",
        "options": {}
      },
      "name": "Send Email1",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1,
      "position": [
        1040,
        320
      ],
      "credentials": {
        "smtp": {
          "id": "8",
          "name": "SMTP account"
        }
      }
    },
    {
      "parameters": {
        "operation": "list",
        "useQueryString": true,
        "queryString": "'1G8E2Uf5Srg-cSdiU4VzzrHCbPOomrAat' in parents and mimeType = 'application/pdf' and name = 'dummy.pdf'",
        "limit": 1,
        "options": {
          "fields": [
            "id"
          ]
        }
      },
      "name": "find file1",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 1,
      "position": [
        700,
        320
      ],
      "credentials": {
        "googleApi": {
          "id": "3",
          "name": "Google account"
        }
      }
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": "={{$node[\"find file1\"].json[\"id\"]}}",
        "binaryPropertyName": "storehere",
        "options": {}
      },
      "name": "download binary1",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 1,
      "position": [
        860,
        320
      ],
      "credentials": {
        "googleApi": {
          "id": "3",
          "name": "Google account"
        }
      }
    }
  ],
  "connections": {
    "find file1": {
      "main": [
        [
          {
            "node": "download binary1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "download binary1": {
      "main": [
        [
          {
            "node": "Send Email1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Working binary having “File Extension,”, “File Name” and “Mime Type”. The following example is the same as provided by Jan:

{
  "nodes": [
    {
      "parameters": {
        "fromEmail": "",
        "toEmail": "",
        "subject": "Test with attachment",
        "text": "With attachment",
        "attachments": "data",
        "options": {}
      },
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1,
      "position": [
        650,
        300
      ],
      "credentials": {
        "smtp": "zoho - n8n.io"
      }
    },
    {
      "parameters": {
        "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
        "responseFormat": "file",
        "options": {}
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    }
  ],
  "connections": {
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Here are the comparative images:
image

Emails with attachments:

Is this a limitation with Google Drive itself or am I doing something wrong here?

That is sadly a limitation of the Google API, as it does not return that information. The only thing we could do is to make a second API request which queries that information via a different endpoint and then attach that data.

Ok, I was able to get it to work by adding the “File Name” for it under Options.

1 Like

Great to hear that you found something that works for you.

Have fun!

1 Like