Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ds): File extension detection misidentifies types #3182

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
### Bug fixes

- Fixed an issue where opening sequential data sets within favorited searches resulted in an error. [#3163](https://github.com/zowe/zowe-explorer-vscode/pull/3163)
- Fixed an issue where automatic file extension detection identified file types incorrectly. [#3181](https://github.com/zowe/zowe-explorer-vscode/pull/3181)

## `3.0.0`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ describe("Dataset utils unit tests - function getExtension", () => {
}
});
it("returns null if no language was detected", () => {
expect(DatasetUtils.getExtension("TEST.DS")).toBe(null);
expect(DatasetUtils.getExtension("TEST.DS.X")).toBe(null);
});
});
10 changes: 2 additions & 8 deletions packages/zowe-explorer/src/trees/dataset/DatasetUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,8 @@ export class DatasetUtils {
const split = bracket > -1 ? label.substring(0, bracket).split(".", limit) : label.split(".", limit);
for (let i = split.length - 1; i > 0; i--) {
for (const [ext, matches] of DS_EXTENSION_MAP.entries()) {
for (const match of matches) {
if (match instanceof RegExp) {
if (match.test(split[i])) {
return ext;
}
} else if (match.includes(split[i])) {
return ext;
}
if (matches.some((match) => (match instanceof RegExp ? match.test(split[i]) : match === split[i]))) {
return ext;
}
}
}
Expand Down
Loading