Skip to content

Commit 749d574

Browse files
Merge pull request #4 from davidbrochart/fix-json
Fix JSON file handling
2 parents e082fe8 + d3eacdf commit 749d574

File tree

1 file changed

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

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,12 @@ export class MySharedDrive extends Drive implements ICollaborativeDrive {
207207
this._providers.set(key, provider);
208208

209209
this._app.serviceManager.contents.get(options.path, { content: true }).then(model => {
210-
const content = model.format === 'base64' ? atob(model.content) : model.content;
210+
let content = model.content;
211+
if (model.format === 'base64') {
212+
content = atob(content);
213+
} else if (model.format === 'json') {
214+
content = JSON.stringify(content);
215+
}
211216
provider.setSource(content);
212217
});
213218

0 commit comments

Comments
 (0)