Skip to content

[Bug]: Google Drive "Get File By Id" with Include File Contents returns corrupted binary data #41509

@SonuSV7719

Description

@SonuSV7719

Is there an existing issue for this?

  • I have searched the existing issues

Description

When using the built-in Google Drive datasource command Drive Get File By Id with Include File Contents = true, the returned file content is corrupted.

This is reproducible for binary files like PDFs. When the response is converted to Base64 and passed to DocumentViewer, nothing is rendered.

However, when I call the Google Drive API directly using a custom authenticated REST API:

GET https://www.googleapis.com/drive/v3/files/{fileId}?alt=media

and then convert that response to Base64, the file renders correctly.

So the same file works with a custom API but not with the built-in Google Drive datasource, which indicates that the datasource is corrupting or incorrectly encoding the binary response.

Expected behavior:
The Google Drive datasource should return the raw binary file correctly so it can be converted to Base64 and displayed in DocumentViewer.

Steps To Reproduce

  1. Create a Google Drive datasource in Appsmith.
  2. Add a query using command "Drive Get File By Id".
  3. Enter a valid PDF file ID.
  4. Enable "Include File Contents".
  5. Run the query.
  6. Convert the response to Base64 and bind it to a DocumentViewer widget.
  7. Observe that the PDF does not render.

Control test:
8. Create a REST API with Google OAuth and call:
GET https://www.googleapis.com/drive/v3/files/{fileId}?alt=media
9. Convert that response to Base64 and bind it to DocumentViewer.
10. The PDF renders correctly.

Public Sample App

No response

Environment

Production

Severity

Low (Cosmetic UI issues)

Issue video log

No response

Version

Cloud

Metadata

Metadata

Labels

BugSomething isn't workingCommunity Reportedissues reported by community membersLowAn issue that is neither critical nor breaks a user flowNeeds TriagingNeeds attention from maintainers to triageProduction

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions