mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-17 09:34:31 +08:00
修复日志目录逻辑
This commit is contained in:
@@ -55,7 +55,7 @@ const CronLogModal = ({
|
||||
const log = data as string;
|
||||
setValue(log || intl.get("暂无日志"));
|
||||
const hasNext = Boolean(
|
||||
log && !logEnded(log) && !log.includes("日志不存在"),
|
||||
log && !logEnded(log) && !log.includes("日志不存在") && !log.includes("日志设置为忽略"),
|
||||
);
|
||||
if (!hasNext && !logEnded(value) && value !== intl.get("启动中...")) {
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -190,22 +190,15 @@ const CronModal = ({
|
||||
{
|
||||
validator: (_, value) => {
|
||||
if (!value) return Promise.resolve();
|
||||
// Allow /dev/null specifically
|
||||
if (value === '/dev/null') return Promise.resolve();
|
||||
// Warn about other absolute paths (server will validate)
|
||||
if (value.startsWith('/')) {
|
||||
// We can't validate the exact path on frontend, but inform user
|
||||
return Promise.resolve();
|
||||
if (value.length > 100) {
|
||||
return Promise.reject(intl.get('日志名称不能超过100个字符'));
|
||||
}
|
||||
// For relative names, enforce strict pattern
|
||||
if (!/^[a-zA-Z0-9_-]+$/.test(value)) {
|
||||
if (!/^(?!.*(?:^|\/)\.{1,2}(?:\/|$))(?:\/)?(?:[\w.-]+\/)*[\w.-]+\/?$/.test(value)) {
|
||||
return Promise.reject(
|
||||
intl.get('日志名称只能包含字母、数字、下划线和连字符'),
|
||||
);
|
||||
}
|
||||
if (value.length > 100) {
|
||||
return Promise.reject(intl.get('日志名称不能超过100个字符'));
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user