mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Return empty string if file without extension is submitted
This commit is contained in:
parent
c464d737ba
commit
3681260054
@ -327,7 +327,7 @@ const Property = React.createClass({
|
||||
className="bs-custom-panel">
|
||||
<div className={'ascribe-property ' + this.props.className}>
|
||||
{this.getLabelAndErrors()}
|
||||
{this.renderChildren(style)}
|
||||
{this.renderChildren(this.props.style)}
|
||||
{footer}
|
||||
</div>
|
||||
</Panel>
|
||||
|
@ -89,11 +89,16 @@ export function computeHashOfFile(file) {
|
||||
/**
|
||||
* Extracts a file extension from a string, by splitting by dot and taking
|
||||
* the last substring
|
||||
*
|
||||
* If a file without an extension is submitted (file), then
|
||||
* this method just returns an empty string.
|
||||
* @param {string} s file's name + extension
|
||||
* @return {string} file extension
|
||||
*
|
||||
* Via: http://stackoverflow.com/a/190878/1263876
|
||||
*/
|
||||
export function extractFileExtensionFromString(s) {
|
||||
return s.split('.').pop();
|
||||
const explodedFileName = s.split('.');
|
||||
return explodedFileName.length > 1 ? explodedFileName.pop()
|
||||
: '';
|
||||
}
|
Loading…
Reference in New Issue
Block a user