mirror of
https://github.com/strapi/strapi.git
synced 2025-08-04 06:49:16 +00:00
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:
parent
b13ecc5da3
commit
cd9296b37b
@ -135,7 +135,9 @@ const EditForm = forwardRef(
|
||||
};
|
||||
|
||||
const handleChange = ({ target: { files } }) => {
|
||||
if (files[0]) {
|
||||
onChange({ target: { name: 'file', value: files[0] } });
|
||||
}
|
||||
};
|
||||
|
||||
const handleClick = async () => {
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user