Skip to content

Commit aad974a

Browse files
committedMay 7, 2023
fix: upload attachment
1 parent 4bc9e94 commit aad974a

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed
 

‎src/GZCTF/ClientApp/src/pages/admin/games/[id]/challenges/[chalId]/Flags.tsx

+25-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
Overlay,
1818
Center,
1919
Code,
20+
List,
2021
} from '@mantine/core'
2122
import { useModals } from '@mantine/modals'
2223
import { showNotification } from '@mantine/notifications'
@@ -282,6 +283,7 @@ const OneAttachmentWithFlags: FC<FlagEditProps> = ({ onDelete }) => {
282283
<Stack>
283284
<TextInput
284285
label="flag 模板"
286+
size="sm"
285287
value={flagTemplate}
286288
placeholder="flag{random_uuid}"
287289
onChange={(e) => setFlagTemplate(e.target.value)}
@@ -292,23 +294,42 @@ const OneAttachmentWithFlags: FC<FlagEditProps> = ({ onDelete }) => {
292294
}}
293295
/>
294296
<Stack spacing={6} pb={8}>
295-
<Text size="xs">请输入 flag 模版字符串,留空以生成随机 UUID 作为 flag</Text>
296-
<Text size="xs">
297+
<Text size="sm">请输入 flag 模版字符串,留空以生成随机 UUID 作为 flag</Text>
298+
<Text size="sm">
297299
若指定 <Code>[TEAM_HASH]</Code> 则它将会被自动替换为队伍 Token
298300
与相关信息所生成的哈希值
299301
</Text>
300-
<Text size="xs">
302+
<Text size="sm">
301303
若未指定 <Code>[TEAM_HASH]</Code> 则将启用 Leet
302304
字符串功能,将会基于模版对花括号内字符串进行变换,需要确保 flag 模版字符串的熵足够高
303305
</Text>
304-
<Text size="xs">
306+
<Text size="sm">
305307
若需要在指定 <Code>[TEAM_HASH]</Code> 的情况下启用 Leet 字符串功能,请在 flag
306308
模版字符串
307309
<Text span weight={700}>
308310
之前
309311
</Text>
310312
添加 <Code>[LEET]</Code> 标记,此时不会检查 flag 模版字符串的熵
311313
</Text>
314+
<Text size="sm" weight="bold">
315+
flag 模编写示例
316+
</Text>
317+
<List size="sm" spacing={6}>
318+
<List.Item>
319+
留空会得到 <Code>{`flag{1bab71b8-117f-4dea-a047-340b72101d7b}`}</Code>
320+
</List.Item>
321+
<List.Item>
322+
<Code>{`flag{hello world}`}</Code> 会得到 <Code>{`flag{He1lo_w0r1d}`}</Code>
323+
</List.Item>
324+
<List.Item>
325+
<Code>{`flag{hello_world_[TEAM_HASH]}`}</Code> 会得到{' '}
326+
<Code>{`flag{hello_world_5418ce4d815c}`}</Code>
327+
</List.Item>
328+
<List.Item>
329+
<Code>{`[LEET]flag{hello world [TEAM_HASH]}`}</Code> 会得到{' '}
330+
<Code>{`flag{He1lo_w0r1d_5418ce4d815c}`}</Code>
331+
</List.Item>
332+
</List>
312333
</Stack>
313334
</Stack>
314335
) : (

‎src/GZCTF/ClientApp/src/pages/admin/games/[id]/challenges/[chalId]/Index.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ const GameChallengeEdit: FC = () => {
9494
})
9595
}
9696
mutate(data.data)
97-
mutateChals((chals) => chals?.map((chal) => (chal.id === numCId ? data.data : chal)), {
98-
revalidate: false,
99-
})
97+
console.log(data.data)
98+
mutateChals()
10099
})
101100
.catch(showErrorNotification)
102101
.finally(() => {

‎src/GZCTF/Repositories/FileRepository.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public async Task<LocalFile> CreateOrUpdateFile(IFormFile file, string? fileName
6969
logger.SystemLog($"缓存位置:{tmp.GetType()}", TaskStatus.Pending, LogLevel.Trace);
7070

7171
await file.CopyToAsync(tmp, token);
72-
return await StoreLocalFile(fileName ?? file.Name, tmp, token);
72+
return await StoreLocalFile(fileName ?? file.FileName, tmp, token);
7373
}
7474

7575
public async Task<LocalFile?> CreateOrUpdateImage(IFormFile file, string fileName, CancellationToken token = default, int resize = 300)

0 commit comments

Comments
 (0)
Please sign in to comment.