If an error occurred when attemping to change file permissions after selecting a file from Google Drive, the LMS frontend incorrectly assumed the attempt had succeeded.
The result was that launching the assignment would then likely fail, as the PDF didn't have the necessary permissions.
This is because the request.execute API doesn't work as the code expected. It always invokes its first argument with the response. The request.then API is the correct Promise-like API. The argument passed to the rejection handler then needs to be processed to turn the result into an Error as expected by the calling code.
With these changes, an error in the enablePublicViewing API should result in an error like:
If an error occurred when attemping to change file permissions after selecting a file from Google Drive, the LMS frontend incorrectly assumed the attempt had succeeded.
The result was that launching the assignment would then likely fail, as the PDF didn't have the necessary permissions.
This is because the
request.execute
API doesn't work as the code expected. It always invokes its first argument with the response. Therequest.then
API is the correct Promise-like API. The argument passed to the rejection handler then needs to be processed to turn the result into anError
as expected by the calling code.With these changes, an error in the
enablePublicViewing
API should result in an error like:changing