-
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function ext = extractFileExtension(filename) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Oh this function is a perfect fit! I will update the codes |
||
% get extension from filename (string or char array) | ||
% this function is called by save_as_file.m to decide which download method to use | ||
|
||
filename = char(filename); | ||
possibleExtensionStartIndex = strfind(filename, '.'); | ||
if ~isempty(possibleExtensionStartIndex) | ||
extensionStartIndex = possibleExtensionStartIndex(end); | ||
ext = filename(extensionStartIndex + 1:end); | ||
else | ||
ext = ''; | ||
end | ||
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.
You can remove a level of nesting here by:
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