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 } }) => {
|
const handleChange = ({ target: { files } }) => {
|
||||||
onChange({ target: { name: 'file', value: files[0] } });
|
if (files[0]) {
|
||||||
|
onChange({ target: { name: 'file', value: files[0] } });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClick = async () => {
|
const handleClick = async () => {
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
const createFileToDownloadName = ({ file: { ext }, fileInfo: { name } }) => {
|
import { get } from 'lodash';
|
||||||
return `${name.replace(ext, '')}${ext}`;
|
|
||||||
|
const createFileToDownloadName = ({ file, fileInfo: { name } }) => {
|
||||||
|
const ext = get(file, 'ext', '');
|
||||||
|
|
||||||
|
return name.endsWith(ext) ? name : `${name}${ext}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default createFileToDownloadName;
|
export default createFileToDownloadName;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user