diff --git a/src/Common/MessageHandler.ts b/src/Common/MessageHandler.ts index 378c58b5f..2a986f835 100644 --- a/src/Common/MessageHandler.ts +++ b/src/Common/MessageHandler.ts @@ -1,6 +1,7 @@ import { FabricMessageTypes } from "Contracts/FabricMessageTypes"; import Q from "q"; import * as _ from "underscore"; +import * as Logger from "../Common/Logger"; import { MessageTypes } from "../Contracts/ExplorerContracts"; import { getDataExplorerWindow } from "../Utils/WindowUtils"; import * as Constants from "./Constants"; @@ -96,10 +97,18 @@ const _sendMessage = (message: any): void => { const portalChildWindow = getDataExplorerWindow(window) || window; if (portalChildWindow === window) { // Current window is a child of portal, send message to portal window - portalChildWindow.parent.postMessage(message, portalChildWindow.document.referrer || "*"); + if (portalChildWindow.document.referrer) { + portalChildWindow.parent.postMessage(message, portalChildWindow.document.referrer); + } else { + Logger.logError("Iframe failed to send message to portal", "MessageHandler"); + } } else { // Current window is not a child of portal, send message to the child window instead (which is data explorer) - portalChildWindow.postMessage(message, portalChildWindow.location.origin || "*"); + if (portalChildWindow.location.origin) { + portalChildWindow.postMessage(message, portalChildWindow.location.origin); + } else { + Logger.logError("Iframe failed to send message to data explorer", "MessageHandler"); + } } } }; diff --git a/src/Explorer/Graph/GraphExplorerComponent/GraphUtil.ts b/src/Explorer/Graph/GraphExplorerComponent/GraphUtil.ts index 3be076000..c16e9aa30 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/GraphUtil.ts +++ b/src/Explorer/Graph/GraphExplorerComponent/GraphUtil.ts @@ -162,7 +162,7 @@ export const addRootChildToGraph = ( * @param value */ export const escapeDoubleQuotes = (value: string): string => { - return value === undefined ? value : value.replace(/"/g, '\\"'); + return value === undefined ? value : value.replace(/\\/g, "\\\\").replace(/"/g, '\\"'); }; /** @@ -186,5 +186,5 @@ export const getQuotedPropValue = (ip: ViewModels.InputPropertyValue): string => * @param value */ export const escapeSingleQuotes = (value: string): string => { - return value === undefined ? value : value.replace(/'/g, "\\'"); + return value === undefined ? value : value.replace(/\\/g, "\\\\").replace(/'/g, "\\'"); }; diff --git a/src/Explorer/Panes/AddCollectionPanel.tsx b/src/Explorer/Panes/AddCollectionPanel.tsx index f208720cf..a3a01d5fb 100644 --- a/src/Explorer/Panes/AddCollectionPanel.tsx +++ b/src/Explorer/Panes/AddCollectionPanel.tsx @@ -576,9 +576,7 @@ export class AddCollectionPanel extends React.Component - - {this.getPartitionKeySubtext()} - + {this.getPartitionKeySubtext()} = ({ - + {getPartitionKeySubtext(userContext.features.partitionKeyDefault, userContext.apiType)} diff --git a/src/Explorer/Panes/__snapshots__/AddCollectionPanel.test.tsx.snap b/src/Explorer/Panes/__snapshots__/AddCollectionPanel.test.tsx.snap index 0831c5a10..93f52c6ce 100644 --- a/src/Explorer/Panes/__snapshots__/AddCollectionPanel.test.tsx.snap +++ b/src/Explorer/Panes/__snapshots__/AddCollectionPanel.test.tsx.snap @@ -223,7 +223,6 @@ exports[`AddCollectionPanel should render Default properly 1`] = `