-
Notifications
You must be signed in to change notification settings - Fork 2
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
issue-16: fix download bug in data product delivery #18
issue-16: fix download bug in data product delivery #18
Conversation
…red-in-data-product-delivery-service
onc/+onc/DataProductFile.m
Outdated
@@ -96,41 +98,44 @@ | |||
if length(lengthData) == 1 | |||
this.fileSize = str2double(lengthData.Value); | |||
else | |||
this.fileSize = strlength(response.Body.Data); | |||
ext = util.extractFileExtension(filename); | |||
if strcmp(ext, 'xml') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove a level of nesting here by:
ext = util.extractFileExtension(filename);
if length(lengthData) == 1
this.fileSize = str2double(lengthData.Value);
elseif strcmp(ext, 'xml')
this.fileSize = length(xmlwrite(response.Body.Data));
else
this.fileSize = strlength(response.Body.Data);
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that did not format well, one sec
onc/+util/extractFileExtension.m
Outdated
@@ -0,0 +1,13 @@ | |||
function ext = extractFileExtension(filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this function you can use: https://www.mathworks.com/help/matlab/ref/fileparts.html which also handles string and char array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh this function is a perfect fit! I will update the codes
The auto test shows that test Test09_ArchiveFiles/testDirectDownloadValidParamsMultiplePages failed when testing on Windows. It happened occasionally when i run the test locally, but it always fixed itself without any modifications. I just ran this test locally and it passed. I'm not sure if this has something to do with the server.
|
Just re-ran the windows auto test and it passed. |
Obtain and save data from response to avoid accessing the website again.