diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index 8e9441547c..019ac013cd 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -20,6 +20,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen - Fixed an issue where clicking on a file in the Unix System Services tree caused the tree to abruptly change focus to the selected item. [#2486](https://github.com/zowe/zowe-explorer-vscode/issues/2486) - Fixed an issue where binary USS files were not fetched using the "Pull from Mainframe" context menu option. [#3355](https://github.com/zowe/zowe-explorer-vscode/issues/3355) - Fixed an issue with Auto Save where a failed UNIX file or data set save operation caused an infinite loop of save requests. [#2406](https://github.com/zowe/zowe-explorer-vscode/issues/2406), [#2627](https://github.com/zowe/zowe-explorer-vscode/issues/2627) +- Fixed an issue where "Open with Encoding" menu failed when tagged encoding was selected for a binary USS file. [#3377](https://github.com/zowe/zowe-explorer-vscode/pull/3377) ## `2.18.0` diff --git a/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts index 3a86769159..bbdefff414 100644 --- a/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts @@ -946,6 +946,23 @@ describe("Shared utils unit tests - function promptForEncoding", () => { expect(blockMocks.showQuickPick.mock.calls[0][1]).toEqual(expect.objectContaining({ placeHolder: "Current encoding is Binary" })); }); + it("prompts for encoding for tagged USS binary file", async () => { + const blockMocks = createBlockMocks(); + const node = new ZoweUSSNode({ + label: "testFile", + collapsibleState: vscode.TreeItemCollapsibleState.None, + session: blockMocks.session, + profile: blockMocks.profile, + parentPath: "/root", + }); + node.setEncoding(binaryEncoding); + blockMocks.showQuickPick.mockImplementationOnce(async (items) => items[0]); + const encoding = await sharedUtils.promptForEncoding(node, "binary"); + expect(blockMocks.showQuickPick).toHaveBeenCalled(); + expect(await blockMocks.showQuickPick.mock.calls[0][0][0]).toEqual({ label: "binary", description: "USS file tag" }); + expect(encoding).toEqual({ kind: "binary" }); + }); + it("prompts for encoding for USS file when profile contains encoding", async () => { const blockMocks = createBlockMocks(); (blockMocks.profile.profile as any).encoding = "IBM-1047"; diff --git a/packages/zowe-explorer/src/shared/utils.ts b/packages/zowe-explorer/src/shared/utils.ts index e1ba2a0ccf..3f5afb4d16 100644 --- a/packages/zowe-explorer/src/shared/utils.ts +++ b/packages/zowe-explorer/src/shared/utils.ts @@ -595,7 +595,7 @@ export async function promptForEncoding(node: IZoweDatasetTreeNode | IZoweUSSTre break; default: if (response != null) { - encoding = { kind: "other", codepage: response }; + encoding = response === "binary" ? { kind: "binary" } : { kind: "other", codepage: response }; } break; }