Only serialize attachments in JSON if exists (#14516)

This commit is contained in:
Chris LaFreniere
2021-03-03 09:06:16 -08:00
committed by GitHub
parent 3f0ca8b714
commit 56dcd4ba50
2 changed files with 11 additions and 9 deletions

View File

@@ -850,7 +850,7 @@ export class CellModel extends Disposable implements ICellModel {
if (this._configurationService?.getValue('notebook.saveConnectionName')) {
metadata.connection_name = this._savedConnectionName;
}
} else if (this._cellType === CellTypes.Markdown) {
} else if (this._cellType === CellTypes.Markdown && this._attachments) {
cellJson.attachments = this._attachments;
}
return cellJson as nb.ICellContents;
@@ -873,7 +873,7 @@ export class CellModel extends Disposable implements ICellModel {
this._isParameter = false;
this._isInjectedParameter = false;
}
this._attachments = cell.attachments || {};
this._attachments = cell.attachments;
this._cellGuid = cell.metadata && cell.metadata.azdata_cell_guid ? cell.metadata.azdata_cell_guid : generateUuid();
this.setLanguageFromContents(cell);
this._savedConnectionName = this._metadata.connection_name;