diff --git a/back/api/log.ts b/back/api/log.ts index 3839dfe0535..918d41188cc 100644 --- a/back/api/log.ts +++ b/back/api/log.ts @@ -31,7 +31,7 @@ export default (app: Router) => { try { const filePath = join( config.logPath, - req.query.path as string, + (req.query.path || '') as string, req.params.file, ); const content = getFileContentByName(filePath); diff --git a/back/services/subscription.ts b/back/services/subscription.ts index eb6d54e0266..8a7921eb779 100644 --- a/back/services/subscription.ts +++ b/back/services/subscription.ts @@ -181,8 +181,9 @@ export default class SubscriptionService { if (doc.sub_before) { beforeStr = execSync(doc.sub_before).toString(); } - } catch (error) { - beforeStr = JSON.stringify(error); + } catch (error: any) { + beforeStr = + (error.stderr && error.stderr.toString()) || JSON.stringify(error); } if (beforeStr) { beforeStr += '\n'; @@ -225,8 +226,9 @@ export default class SubscriptionService { if (sub.sub_after) { afterStr = execSync(sub.sub_after).toString(); } - } catch (error) { - afterStr = JSON.stringify(error); + } catch (error: any) { + afterStr = + (error.stderr && error.stderr.toString()) || JSON.stringify(error); } if (afterStr) { afterStr = `\n\n${afterStr}`; diff --git a/src/pages/crontab/detail.tsx b/src/pages/crontab/detail.tsx index d5c571c39da..5dabea76620 100644 --- a/src/pages/crontab/detail.tsx +++ b/src/pages/crontab/detail.tsx @@ -115,9 +115,13 @@ const CronDetailModal = ({ const onClickItem = (item: LogItem) => { localStorage.setItem('logCron', currentCron.id); - setLogUrl(`${config.apiPrefix}logs/${item.directory}/${item.filename}`); + setLogUrl( + `${config.apiPrefix}logs/${item.filename}?path=${item.directory || ''}`, + ); request - .get(`${config.apiPrefix}logs/${item.directory}/${item.filename}`) + .get( + `${config.apiPrefix}logs/${item.filename}?path=${item.directory || ''}`, + ) .then((data) => { setLog(data.data); setIsLogModalVisible(true); diff --git a/src/pages/subscription/modal.tsx b/src/pages/subscription/modal.tsx index 9881f71553c..7ac0c211875 100644 --- a/src/pages/subscription/modal.tsx +++ b/src/pages/subscription/modal.tsx @@ -195,7 +195,9 @@ const SubscriptionModal = ({ dependences, branch, extensions, - ] = text.split(' ').map((x) => x.trim()); + ] = text + .split(' ') + .map((x) => x.trim().replace(/\"/g, '').replace(/\'/, '')); form.setFieldsValue({ type: type === 'raw' @@ -210,6 +212,7 @@ const SubscriptionModal = ({ branch, extensions, }); + form.validateFields(['url']); } }, []);