-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Hello,
There appears to be a bug in the convert_mimetype_of_file_on_google_drive
tool function.
Error:
When calling the tool with a valid file ID for a Google Slides presentation and dstMimeType: 'application/pdf'
, it fails with the following error:
ReferenceError: blob is not defined at management_drive.js:267:128
Code Analysis:
The issue seems to be in the management_drive.js
file within the convert_mimetype_of_file_on_google_drive
function.
The current implementation appears to be:
const file = DriveApp.getFileById(id);
const blob = file.getAs(dstMimeType);
const newFile = DriveApp.createFile(blob.setName(file.getName()));
Suggested Fix:
A more robust implementation, which should prevent this error, is to explicitly get the file's blob before converting its type. The line should be changed as follows:
From:
const blob = file.getAs(dstMimeType);
To:
const blob = file.getBlob().getAs(dstMimeType);
This change ensures a valid blob is retrieved before the conversion is attempted and should resolve the issue.
Thank you for maintaining this useful toolset.