Skip to content

Commit 9e011f4

Browse files
author
tingfuyeh
committed
fix: 增加配置文件下发路径校验
1 parent 3df560a commit 9e011f4

File tree

2 files changed

+32
-23
lines changed

2 files changed

+32
-23
lines changed

web/src/polaris/configuration/fileGroup/detail/file/Page.tsx

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -309,28 +309,7 @@ export default function Page(props: DuckCmpProps<Duck>) {
309309
</Text>
310310
</FormText>
311311
</FormItem>
312-
<FormItem label={'推送方式'}>
313-
<FormText>{ConfigFileModeMap[currentNode.supported_client]}</FormText>
314-
</FormItem>
315-
{currentNode.supported_client !== ConfigFileMode.Default && (
316-
<FormItem label={'配置下发路径'}>
317-
<FormText>{currentNode?.persistent?.path || '-'}</FormText>
318-
</FormItem>
319-
)}
320-
</Col>
321-
<Col span={12}>
322-
<FormItem label='最后修改人'>
323-
<FormText>{currentNode.modifyBy || '-'}</FormText>
324-
</FormItem>
325-
<FormItem label='最后发布人'>
326-
<FormText>{currentNode.releaseBy || '-'}</FormText>
327-
</FormItem>
328-
<FormItem label='备注'>
329-
<FormText>{currentNode.comment || '-'}</FormText>
330-
</FormItem>
331-
<FormItem label='格式'>
332-
<FormText>{currentNode.format || '-'}</FormText>
333-
</FormItem>
312+
334313
{currentNode.supported_client !== ConfigFileMode.Default && (
335314
<>
336315
<FormItem label={'文件保存编码'}>
@@ -353,14 +332,38 @@ export default function Page(props: DuckCmpProps<Duck>) {
353332
}
354333
trigger={'click'}
355334
>
356-
{'显示全部'}
335+
<Button type={'link'}>{'显示全部'}</Button>
357336
</Popover>
358337
)}
359338
</FormText>
360339
</FormItem>
361340
</>
362341
)}
363342
</Col>
343+
<Col span={12}>
344+
<FormItem label='最后修改人'>
345+
<FormText>{currentNode.modifyBy || '-'}</FormText>
346+
</FormItem>
347+
<FormItem label='最后发布人'>
348+
<FormText>{currentNode.releaseBy || '-'}</FormText>
349+
</FormItem>
350+
<FormItem label='备注'>
351+
<FormText>{currentNode.comment || '-'}</FormText>
352+
</FormItem>
353+
<FormItem label='格式'>
354+
<FormText>{currentNode.format || '-'}</FormText>
355+
</FormItem>
356+
<FormItem label={'推送方式'}>
357+
<FormText>{ConfigFileModeMap[currentNode.supported_client]}</FormText>
358+
</FormItem>
359+
{currentNode.supported_client !== ConfigFileMode.Default && (
360+
<>
361+
<FormItem label={'配置下发路径'}>
362+
<FormText>{currentNode?.persistent?.path || '-'}</FormText>
363+
</FormItem>
364+
</>
365+
)}
366+
</Col>
364367
</Row>
365368
</Form>
366369
<Justify
@@ -439,6 +442,7 @@ export default function Page(props: DuckCmpProps<Duck>) {
439442
.catch(err => {
440443
notification.error({ description: err.toString() })
441444
})
445+
return false
442446
} else {
443447
notification.error({
444448
description: `文件大小大于${500 * 1024}bytes,请重新上传`,

web/src/polaris/configuration/fileGroup/detail/file/operation/CreateDuck.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,11 @@ const validator = CreateForm.combineValidators<Values, any>({
294294
if (!v) return '请选择格式'
295295
},
296296
persistent: {
297+
path(v) {
298+
if (!/^[\w\-_\/\.]{0,100}$/.test(v)) {
299+
return '不超过100个字符,只能包含英文、数字、"-"(英文)、"_"(英文)、"."(英文)、"/"(英文)'
300+
}
301+
},
297302
postCmd(v) {
298303
if (v?.length > 200) {
299304
return '命令长度不能超过200'

0 commit comments

Comments
 (0)