Riley Lark
Riley Lark

Reputation: 20890

Copy Realtime documents of drive files when user chooses to "Make a Copy"

My app uses the realtime api to store most of the data in a document. The Drive UI gives users the option of making a copy of the files my app created, but the copies do not include copies of the realtime documents associated with the files! Aiee!

Is there a way around this besides constantly syncing my realtime documents with the file bodies themselves? My documents will be megabytes large, so uploading them as file bodies frequently would be prohibitive.

Upvotes: 2

Views: 132

Answers (1)

Frodo Baggins
Frodo Baggins

Reputation: 8543

My understanding is that the real time model is not copied when the mimetype of the file is anything but the shortcut type:

application/vnd.google-apps.drive-sdk

If you use any mimetype other than that it's assumed you're storing the file contents as well as the real time model, so when a copy operation is performed, only a copy of the file contents are made, not the RT model. If you're not using a realtime shortcut type, it's expected that you have a normal Drive file with content and just that content is copied over. When you load that file into your application, you should see that the RT model is empty and apply the content, if there is any.

This is what the Drive team told me. Thinking about it, I guess the idea is to not copy the history of the file over to the new one, just the raw content.

Upvotes: 2

Related Questions