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

Fixed file extension when downloading a single IFS file #1916

Merged
merged 1 commit into from
Mar 6, 2024
Merged
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
10 changes: 5 additions & 5 deletions src/views/ifsBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ export function initializeIFSBrowser(context: vscode.ExtensionContext) {
const remoteFilepath = path.join(ibmi.getLastDownloadLocation(), path.basename(node.path));
downloadLocation = (await vscode.window.showSaveDialog({
defaultUri: vscode.Uri.file(remoteFilepath),
filters: { 'Streamfile': [extname(node.path) || '*'] }
filters: { 'Streamfile': [extname(node.path).substring(1) || '*'] }
}))?.path;
}

Expand All @@ -760,7 +760,7 @@ export function initializeIFSBrowser(context: vscode.ExtensionContext) {
for (const item of items) {
const targetPath = item.path;
task.report({ message: targetPath, increment });
if (saveIntoDirectory) {
if (saveIntoDirectory) {
const target = path.join(Tools.fixWindowsPath(downloadLocation!), path.basename(targetPath));
if (item.file.type === "directory") {
let proceed = !existsSync(target);
Expand All @@ -782,7 +782,7 @@ export function initializeIFSBrowser(context: vscode.ExtensionContext) {
}
}
}
else{
else {
await ibmi.downloadFile(downloadLocation!, targetPath);
}
}
Expand Down Expand Up @@ -871,6 +871,6 @@ async function showOpenDialog() {
/**
* Filters the content of an IFSItem array to keep only items whose parent are not in the array
*/
function reduceIFSPath(item: IFSItem, index: number, array: IFSItem[]) {
return !array.filter(i => i.file.type === "directory" && i !== item).some(folder => item.file.path.startsWith(folder.file.path));
function reduceIFSPath(item: IFSItem, index: number, array: IFSItem[]) {
return !array.filter(i => i.file.type === "directory" && i !== item).some(folder => item.file.path.startsWith(folder.file.path));
}