in src/AppServiceFileSystem.ts [35:63]
public async writeFileImpl(context: IActionContext, node: FileTreeItem, content: Uint8Array, _originalUri: Uri): Promise<void> {
const showSavePromptKey: string = 'showSavePrompt';
if (getWorkspaceSetting<boolean>(showSavePromptKey)) {
const message: string = localize('saveConfirmation', 'Saving "{0}" will update the file "{0}" in "{1}".', node.label, node.site.fullName);
const result: MessageItem | undefined = await context.ui.showWarningMessage(message, DialogResponses.upload, DialogResponses.alwaysUpload, DialogResponses.dontUpload);
if (result === DialogResponses.alwaysUpload) {
await updateGlobalSetting(showSavePromptKey, false);
} else if (result === DialogResponses.dontUpload) {
throw new UserCancelledError('dontUpload');
}
}
let etag: string = nonNullValue(this._etags.get(node.fullId), 'etag');
try {
this.appendLineToOutput(localize('updating', 'Updating "{0}" ...', node.label), { resourceName: node.site.fullName });
await putFile(context, node.site, content, node.path, etag);
this.appendLineToOutput(localize('done', 'Updated "{0}".', node.label), { resourceName: node.site.fullName });
} catch (error) {
const parsedError: IParsedError = parseError(error);
if (parsedError.errorType === '412' && /etag/i.test(parsedError.message)) {
throw new Error(localize('etagError', 'ETag does not represent the latest state of the file "{0}". Download the file from Azure to get the latest version.', node.label));
}
throw error;
}
etag = (await getFile(context, node.site, node.path)).etag;
this._etags.set(node.fullId, etag);
await node.refresh(context);
}