Fix replace media (#7787)

* Fixes #7776

Signed-off-by: soupette <cyril.lpz@gmail.com>

* Fix PR feedback

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
cyril lopez 2020-09-09 10:18:22 +02:00 committed by GitHub
parent b13ecc5da3
commit cd9296b37b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -135,7 +135,9 @@ const EditForm = forwardRef(
};
const handleChange = ({ target: { files } }) => {
if (files[0]) {
onChange({ target: { name: 'file', value: files[0] } });
}
};
const handleClick = async () => {

View File

@ -1,5 +1,9 @@
const createFileToDownloadName = ({ file: { ext }, fileInfo: { name } }) => {
return `${name.replace(ext, '')}${ext}`;
import { get } from 'lodash';
const createFileToDownloadName = ({ file, fileInfo: { name } }) => {
const ext = get(file, 'ext', '');
return name.endsWith(ext) ? name : `${name}${ext}`;
};
export default createFileToDownloadName;