Fix FileInputButton breaking when path is null (#2129)

This commit is contained in:
Gregory Schier 2020-05-06 16:08:17 -07:00 committed by GitHub
parent 453745d3e2
commit 9554c4675f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,7 +78,10 @@ class FileInputButton extends React.PureComponent<Props> {
render() {
const { showFileName, showFileIcon, path, name, ...extraProps } = this.props;
const fileName = pathBasename(path);
// NOTE: Basename fails if path is not a string, so let's make sure it is
const fileName = typeof path === 'string' ? pathBasename(path) : null;
return (
<button
type="button"