Skip to content

Commit

Permalink
[Fixes #1018] The client should not submit xml or sld(if provided) as…
Browse files Browse the repository at this point in the history
… base_file in dataset uploads (#1019)
  • Loading branch information
DavidQuartz authored Jun 13, 2022
1 parent 3cead0f commit 02cde84
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions geonode_mapstore_client/client/js/routes/UploadDataset.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ function UploadList({
setUploadContainerProgress((prevFiles) => ({ ...prevFiles, [fileName]: percentCompleted }));
};

function getValidFileExt({ files }) {
const validFile = Object.keys(files).find(key => key !== 'sld' && key !== 'xml');

return validFile;
}

function handleUploadProcess() {
if (!loading) {
setLoading(true);
Expand All @@ -180,6 +186,11 @@ function UploadList({
const readyUpload = readyUploads[baseName];
cancelTokens[baseName] = axios.CancelToken;
sources[baseName] = cancelTokens[baseName].source();

const mainExt = (readyUpload.mainExt !== 'sld' && readyUpload.mainExt !== 'xml') ? readyUpload.mainExt : getValidFileExt(readyUpload);

readyUpload.mainExt = mainExt;

return uploadDataset({
file: readyUpload.files[readyUpload.mainExt],
ext: readyUpload.mainExt,
Expand Down

0 comments on commit 02cde84

Please sign in to comment.