fix: don't chang name when changing file for publish

This commit is contained in:
Sean Yesmunt 2018-04-03 00:05:11 -04:00
parent 90f9fbf99f
commit 31991a2ed1

View file

@ -140,13 +140,20 @@ class PublishForm extends React.PureComponent<Props> {
}
handleFileChange(filePath: string, fileName: string) {
const { updatePublishForm, channel } = this.props;
const parsedFileName = fileName.replace(regexInvalidURI, '');
const uri = this.getNewUri(parsedFileName, channel);
const { updatePublishForm, channel, name } = this.props;
const newFileParams: {
filePath: string,
name?: string,
uri?: string
} = { filePath };
if (filePath) {
updatePublishForm({ filePath, name: parsedFileName, uri });
if (!name) {
const parsedFileName = fileName.replace(regexInvalidURI, '');
const uri = this.getNewUri(parsedFileName, channel);
newFileParams.name = parsedFileName;
}
updatePublishForm(newFileParams);
}
handleNameChange(name: ?string) {