From c68b866ef76234dbe65bf012509b7f3cde2bb24c Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 6 Sep 2017 17:16:25 -0500 Subject: more robust file upload extension (#7389) --- webapp/components/file_upload.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'webapp') diff --git a/webapp/components/file_upload.jsx b/webapp/components/file_upload.jsx index eb966aeed..479dfa145 100644 --- a/webapp/components/file_upload.jsx +++ b/webapp/components/file_upload.jsx @@ -296,8 +296,16 @@ class FileUpload extends React.Component { min = String(d.getMinutes()); } - const ext = file.name.lastIndexOf('.'); - const name = formatMessage(holders.pasted) + d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + hour + '-' + min + (ext >= 0 ? file.name.substr(ext) : ''); + var ext = ''; + if (file.name) { + if (file.name.includes('.')) { + ext = file.name.substr(file.name.lastIndexOf('.')); + } + } else if (items[i].type.includes('/')) { + ext = '.' + items[i].type.split('/')[1].toLowerCase(); + } + + const name = formatMessage(holders.pasted) + d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + hour + '-' + min + ext; const request = uploadFile( file, -- cgit v1.2.3-1-g7c22 From e589accdaf38bb82cb5d3b5dd84eadf9bfb58b5c Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Wed, 6 Sep 2017 23:39:44 -0400 Subject: Fix webapp plugins for production builds (#7392) --- webapp/components/profile_popover.jsx | 4 ++++ webapp/plugins/pluggable/pluggable.jsx | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'webapp') diff --git a/webapp/components/profile_popover.jsx b/webapp/components/profile_popover.jsx index 9e7d7636a..63812428c 100644 --- a/webapp/components/profile_popover.jsx +++ b/webapp/components/profile_popover.jsx @@ -19,6 +19,10 @@ import PropTypes from 'prop-types'; import React from 'react'; export default class ProfilePopover extends React.Component { + static getComponentName() { + return 'ProfilePopover'; + } + constructor(props) { super(props); diff --git a/webapp/plugins/pluggable/pluggable.jsx b/webapp/plugins/pluggable/pluggable.jsx index 566e024e5..c81d8df5e 100644 --- a/webapp/plugins/pluggable/pluggable.jsx +++ b/webapp/plugins/pluggable/pluggable.jsx @@ -33,6 +33,8 @@ export default class Pluggable extends React.PureComponent { return null; } + const childName = child.getComponentName(); + // Include any props passed to this component or to the child component let props = {...this.props}; Reflect.deleteProperty(props, 'children'); @@ -40,8 +42,8 @@ export default class Pluggable extends React.PureComponent { props = {...props, ...this.props.children.props}; // Override the default component with any registered plugin's component - if (components.hasOwnProperty(child.name)) { - const PluginComponent = components[child.name]; + if (components.hasOwnProperty(childName)) { + const PluginComponent = components[childName]; return (