1
votes

Why is it required to have 'application/vnd.google-apps.drive-sdk' as the mimetype when creating a shortcut in drive (see https://developers.google.com/drive/web/integrate-create)?

Wouldn't any customized mime-type work ?

1

1 Answers

3
votes

A 'shortcut' in Drive using that MIME type is a specific construct that lets Drive know that the real content is actually stored somewhere other than Drive. Note: It isn't exactly equivalent to a generic shortcut you might be use to on an OS like Windows.

When you open a item with the application/vnd.google-apps.drive-sdk MIME type set, Drive knows that it should open the Open URL that was registered by the Drive application that created the shortcut and pass it the necessary state information to correctly handle the request.

Using MIME type to direct this behavior makes sense for several reasons.

  • If it wasn't MIME type you would still need to set some other custom property to indicate it was a shortcut, otherwise Drive wouldn't know to handle it as a shortcut rather than real content in Drive.
  • Since 3rd party applications would also need to handle them uniquely, it makes it easier to filter out unwanted results. For instance, even if your shortcut was to a text file, you don't want to set the MIME type to text/plain anyway, since that would lead applications to try and read/write from it like it was the text file, even though it was a shortcut.
  • MIME type specifies what content to expect in the file/resource. application/vnd.google-apps.drive-sdk lets you know not to expect any content. Setting a different MIME type, would more than likely be lying.