Skip to content

Commit

Permalink
Merge pull request #1916 from codefori/fix/ifsSingleDownloadFilename
Browse files Browse the repository at this point in the history
Fixed file extension when downloading a single IFS file
  • Loading branch information
sebjulliand authored Mar 6, 2024
2 parents 24ee3fa + b999eeb commit d12b218
Showing 1 changed file with 5 additions and 5 deletions.
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));
}

0 comments on commit d12b218

Please sign in to comment.