Skip to content

Commit

Permalink
Merge pull request #2501 from zowe/fix-webview-for-web
Browse files Browse the repository at this point in the history
Fix webview for web
  • Loading branch information
JillieBeanSim authored Oct 9, 2023
2 parents 8b2e848 + 4573ba2 commit 3fe4ec8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/zowe-explorer/i18n/sample/src/uss/actions.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"deleteUssPrompt.confirmation.message": "Are you sure you want to delete the following item?\nThis will permanently remove the following file or folder from your system.\n\n{0}",
"deleteUssPrompt.confirmation.cancel.log.debug": "Delete action was canceled.",
"ZoweUssNode.copyDownload.progress": "Copying file structure...",
"ZoweUssNode.copyUpload.progress": "Pasting files...",
"uss.paste.apiNotAvailable": "The paste operation is not supported for this node."
"uss.paste.apiNotAvailable": "The paste operation is not supported for this node.",
"ZoweUssNode.copyUpload.progress": "Pasting files..."
}
8 changes: 7 additions & 1 deletion packages/zowe-explorer/webviews/edit-attributes/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ export function App() {
useEffect(() => {
window.addEventListener("message", (event) => {
// Prevent users from sending data into webview outside of extension/webview context
if (!event.origin?.startsWith("vscode-webview://")) {
const eventUrl = new URL(event.origin);
const isWebUser =
(eventUrl.protocol === document.location.protocol && eventUrl.hostname === document.location.hostname) ||
eventUrl.hostname.endsWith(".github.dev");
const isLocalVSCodeUser = eventUrl.protocol === "vscode-webview:";

if (!isWebUser && !isLocalVSCodeUser) {
return;
}

Expand Down

0 comments on commit 3fe4ec8

Please sign in to comment.