diff --git a/src/firefly/java/edu/caltech/ipac/firefly/data/DownloadRequest.java b/src/firefly/java/edu/caltech/ipac/firefly/data/DownloadRequest.java index 06dfb89a81..4ef47aea4f 100644 --- a/src/firefly/java/edu/caltech/ipac/firefly/data/DownloadRequest.java +++ b/src/firefly/java/edu/caltech/ipac/firefly/data/DownloadRequest.java @@ -70,11 +70,11 @@ public void setFilePrefix(String filePrefix) { public boolean isSelectAll () { return _selectInfo.isSelectAll(); } - public String getBaseFileName() { return getParam(BASE_FILE_NAME); } + public String getBaseFileName() { return getParam(TITLE); } //use Title as the file name also public String getDataSource() { return getParam(DATA_SOURCE); } - public String getTitle() { return getParam(BASE_FILE_NAME); } + public String getTitle() { return getParam(TITLE); } public String getEmail() { return getParam(EMAIL); } diff --git a/src/firefly/java/edu/caltech/ipac/firefly/server/util/DownloadScript.java b/src/firefly/java/edu/caltech/ipac/firefly/server/util/DownloadScript.java index 77eff87e4f..87f89db57f 100644 --- a/src/firefly/java/edu/caltech/ipac/firefly/server/util/DownloadScript.java +++ b/src/firefly/java/edu/caltech/ipac/firefly/server/util/DownloadScript.java @@ -176,6 +176,8 @@ public class DownloadScript { # move file to main directory and cleanup mv "$downloadedFile" "$destPath" echo ">> Saved as $destPath" + + [zip-logic-added-here] cd "$startDir" rm -rf "$tmpDir" diff --git a/src/firefly/js/core/background/BackgroundCntlr.js b/src/firefly/js/core/background/BackgroundCntlr.js index 279014578f..80144406ca 100644 --- a/src/firefly/js/core/background/BackgroundCntlr.js +++ b/src/firefly/js/core/background/BackgroundCntlr.js @@ -198,11 +198,11 @@ function bgSetInfo(action) { function bgPackage(action) { return (dispatch) => { const {dlRequest={}, searchRequest, selectionInfo, bgKey='', downloadType} = action.payload; - let {fileLocation, wsSelect, BaseFileName} = dlRequest; + let {fileLocation, wsSelect, Title} = dlRequest; //use Title as the file name - BaseFileName = BaseFileName.endsWith('.zip') ? BaseFileName : BaseFileName.trim() + '.zip'; + Title = Title.endsWith('.zip') ? Title : Title.trim() + '.zip'; if (fileLocation === WORKSPACE) { - if (!validateFileName(wsSelect, BaseFileName)) return false; + if (!validateFileName(wsSelect, Title)) return false; } const onComplete = (jobInfo) => { diff --git a/src/firefly/js/templates/common/ttFeatureWatchers.js b/src/firefly/js/templates/common/ttFeatureWatchers.js index 339d0602b3..c3a4925956 100644 --- a/src/firefly/js/templates/common/ttFeatureWatchers.js +++ b/src/firefly/js/templates/common/ttFeatureWatchers.js @@ -200,7 +200,7 @@ export const PrepareDownload = React.memo(({table_id, tbl_title, viewerId, showF viewerId, DataSource: dataSource, help_id:'table.obsCorePackage', - BaseFileName: fileName ? fileName+ `_${baseFileName}` : `${baseFileName}` + Title: fileName ? fileName+ `_${baseFileName}` : `${baseFileName}` }}}> {!isDatalink && hideDownloadDialog()}/>); - const dlTitle = get(dlParams, 'BaseFileName', 'Download' + '-' + dlTitleIdx); //use BaseFileName as title as well + const dlTitle = get(dlParams, 'Title', 'Download' + '-' + dlTitleIdx); //title will also be filename of the downloaded file const preTitleMessage = dlParams?.PreTitleMessage ?? ''; return ( @@ -241,9 +241,8 @@ DownloadOptionPanel.propTypes = { validateOnSubmit: PropTypes.func, // to validate form inputs on submit dlParams: PropTypes.shape({ // these params should be used as defaults value if they appears as input fields - TitlePrefix: PropTypes.string, // default title of the download.. an index number will be appended to this. FilePrefix: PropTypes.string, // packaged file prefix - BaseFileName: PropTypes.string, // zip file name + Title: PropTypes.string, // title in the UI, also the file name of the downloaded file DataSource: PropTypes.string, MaxBundleSize: PropTypes.number, FileGroupProcessor: PropTypes.string.isRequired, @@ -255,7 +254,7 @@ export function TitleField({style={}, value, label='Title:', size=30}) { return ( diff --git a/src/firefly/test/edu/caltech/ipac/firefly/util/DownloadScriptTest.java b/src/firefly/test/edu/caltech/ipac/firefly/util/DownloadScriptTest.java index 811cc27659..5c4e539349 100644 --- a/src/firefly/test/edu/caltech/ipac/firefly/util/DownloadScriptTest.java +++ b/src/firefly/test/edu/caltech/ipac/firefly/util/DownloadScriptTest.java @@ -82,8 +82,7 @@ public void curl() throws Exception { assertTrue("Mkdir should be present", lines.stream().anyMatch(line -> line.contains("mkdir "))); assertTrue("Unzip command should be present", lines.stream().anyMatch(line -> line.contains("unzip -qq"))); } - - @Ignore("Need to update test to match new script format") + @Test public void wgetUnzip() throws Exception { List fileInfoList = List.of(new FileGroup(List.of(