Skip to content

Commit da653e9

Browse files
Fix content type (#6)
* Fix content type * Again
1 parent d952001 commit da653e9

File tree

1 file changed

+6
-2
lines changed
  • packages/my-shared-docprovider/src

1 file changed

+6
-2
lines changed

packages/my-shared-docprovider/src/drive.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,17 @@ export class MySharedDrive extends Drive implements ICollaborativeDrive {
206206

207207
this._providers.set(key, provider);
208208

209-
this._app.serviceManager.contents.get(options.path, { content: true }).then(model => {
209+
this._app.serviceManager.contents.get(options.path, { type: options.contentType, format: options.format, content: true }).then(model => {
210210
let content = model.content;
211211
if (model.format === 'base64') {
212212
content = atob(content);
213-
} else if (model.format === 'json') {
213+
}
214+
else if (options.format === 'text' && model.format === 'json') {
214215
content = JSON.stringify(content);
215216
}
217+
else if (options.format === 'json' && model.format === 'text') {
218+
content = JSON.parse(content);
219+
}
216220
provider.setSource(content);
217221
});
218222

0 commit comments

Comments
 (0)