修复脚本管理上传文件文件名乱码

This commit is contained in:
whyour 2024-04-22 22:39:27 +08:00
parent 6657ff0560
commit f723631647
4 changed files with 7 additions and 5 deletions

View File

@ -136,7 +136,7 @@ export default (app: Router) => {
} }
if (req.file) { if (req.file) {
await fs.rename(req.file.path, join(path, req.file.filename)); await fs.rename(req.file.path, join(path, filename));
return res.send({ code: 200 }); return res.send({ code: 200 });
} }

View File

@ -173,8 +173,9 @@ const CronDetailModal = ({
<> <>
{intl.get('确认保存文件')} {intl.get('确认保存文件')}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{' '}
{scriptInfo.filename} {scriptInfo.filename}
</Text>{' '} </Text>
{intl.get(',保存后不可恢复')} {intl.get(',保存后不可恢复')}
</> </>
), ),

View File

@ -39,8 +39,8 @@ const EditScriptNameModal = ({
setLoading(true); setLoading(true);
const { path = '', filename: inputFilename, directory = '' } = values; const { path = '', filename: inputFilename, directory = '' } = values;
const formData = new FormData(); const formData = new FormData();
formData.append('file', file as any); formData.append('file', file || '');
formData.append('filename', inputFilename); formData.append('filename', file?.name || inputFilename);
formData.append('path', path); formData.append('path', path);
formData.append('content', ''); formData.append('content', '');
formData.append('directory', directory); formData.append('directory', directory);

View File

@ -218,8 +218,9 @@ const Script = () => {
<> <>
{intl.get('确认保存文件')} {intl.get('确认保存文件')}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{' '}
{currentNode.title} {currentNode.title}
</Text>{' '} </Text>
{intl.get(',保存后不可恢复')} {intl.get(',保存后不可恢复')}
</> </>
), ),