mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix: error when downloading async migration file (#6586)
This commit is contained in:
parent
28c633e369
commit
b86ea5dd61
@ -270,14 +270,15 @@ const AsyncTasksButton = (props) => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
const token = app.apiClient.auth.token;
|
const token = app.apiClient.auth.token;
|
||||||
const collection = cm.getCollection(record.title.collection);
|
const collection = cm.getCollection(record.title.collection);
|
||||||
const compiledTitle = compile(collection.title);
|
const compiledTitle = compile(collection?.title);
|
||||||
const suffix = record?.title?.actionType === 'export-attachments' ? '-attachments.zip' : '.xlsx';
|
const suffix = record?.title?.actionType === 'export-attachments' ? '-attachments.zip' : '.xlsx';
|
||||||
const fileText = `${compiledTitle}${suffix}`;
|
const fileText = `${compiledTitle}${suffix}`;
|
||||||
const filename = encodeURIComponent(fileText); // 避免中文或特殊字符问题
|
const filename =
|
||||||
|
record?.title?.actionType !== 'create migration' ? encodeURIComponent(fileText) : null;
|
||||||
const url = app.getApiUrl(
|
const url = app.getApiUrl(
|
||||||
`asyncTasks:fetchFile/${record.taskId}?token=${token}&__appName=${encodeURIComponent(
|
`asyncTasks:fetchFile/${record.taskId}?token=${token}&__appName=${encodeURIComponent(
|
||||||
appInfo?.data?.name || app.name,
|
appInfo?.data?.name || app.name,
|
||||||
)}&filename=${filename}`,
|
)}${filename ? `&filename=${filename}` : ''}`,
|
||||||
);
|
);
|
||||||
window.open(url);
|
window.open(url);
|
||||||
}}
|
}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user