Skip to content

Commit 13c92f6

Browse files
committed
fix: MIME_TYPE when upload images
1 parent 65e73bd commit 13c92f6

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

GZCTF/ClientApp/src/components/ChallengePanel.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const ChallengePanel: FC = () => {
3333
const tags = Object.keys(challenges ?? {})
3434
const [activeTab, setActiveTab] = useState<ChallengeTag | 'All'>('All')
3535
const [hideSolved, setHideSolved] = useLocalStorage({
36-
key: 'hideSolved',
36+
key: 'hide-solved',
3737
defaultValue: false,
3838
})
3939

GZCTF/ClientApp/src/components/TeamEditModal.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { mdiCheck, mdiClose, mdiCloseCircle, mdiRefresh, mdiCrown } from '@mdi/j
2626
import { Icon } from '@mdi/react'
2727
import { showErrorNotification } from '@Utils/ApiErrorHandler'
2828
import api, { TeamInfoModel, TeamUserInfoModel } from '@Api'
29+
import { ACCEPT_IMAGE_MIME_TYPE } from '@Utils/ThemeOverride'
2930

3031
interface TeamEditModalProps extends ModalProps {
3132
team: TeamInfoModel | null
@@ -334,7 +335,7 @@ const TeamEditModal: FC<TeamEditModalProps> = (props) => {
334335
minHeight: '220px',
335336
}}
336337
maxSize={3 * 1024 * 1024}
337-
accept={['image/png', 'image/gif', 'image/jpeg']}
338+
accept={ACCEPT_IMAGE_MIME_TYPE}
338339
>
339340
<Group position="center" spacing="xl" style={{ minHeight: 240, pointerEvents: 'none' }}>
340341
{avatarFile ? (

GZCTF/ClientApp/src/pages/account/Profile.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import WithNavBar from '@Components/WithNavbar'
2525
import { showErrorNotification } from '@Utils/ApiErrorHandler'
2626
import { usePageTitle } from '@Utils/PageTitle'
2727
import api, { ProfileUpdateModel } from '@Api'
28+
import { ACCEPT_IMAGE_MIME_TYPE } from '@Utils/ThemeOverride'
2829

2930
const Profile: FC = () => {
3031
const [dropzoneOpened, setDropzoneOpened] = useState(false)
@@ -306,7 +307,7 @@ const Profile: FC = () => {
306307
minHeight: '220px',
307308
}}
308309
maxSize={3 * 1024 * 1024}
309-
accept={['image/png', 'image/gif', 'image/jpeg']}
310+
accept={ACCEPT_IMAGE_MIME_TYPE}
310311
>
311312
<Group
312313
position="center"

GZCTF/ClientApp/src/pages/admin/games/[id]/Info.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { Icon } from '@mdi/react'
2323
import WithGameEditTab from '@Components/admin/WithGameEditTab'
2424
import { showErrorNotification } from '@Utils/ApiErrorHandler'
2525
import api, { GameInfoModel } from '@Api'
26+
import { ACCEPT_IMAGE_MIME_TYPE } from '@Utils/ThemeOverride'
2627

2728
const GameInfoEdit: FC = () => {
2829
const { id } = useParams()
@@ -246,7 +247,7 @@ const GameInfoEdit: FC = () => {
246247
})
247248
}}
248249
maxSize={3 * 1024 * 1024}
249-
accept={['image/png', 'image/gif', 'image/jpeg']}
250+
accept={ACCEPT_IMAGE_MIME_TYPE}
250251
disabled={disabled}
251252
styles={{
252253
root: {

GZCTF/ClientApp/src/utils/ThemeOverride.ts

+2
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,5 @@ export const useTooltipStyles = createStyles((theme) => ({
112112
color: theme.colorScheme === 'dark' ? theme.colors.white[2] : theme.colors.gray[7],
113113
},
114114
}))
115+
116+
export declare const ACCEPT_IMAGE_MIME_TYPE: ("image/png" | "image/gif" | "image/jpeg" | "image/webp")[];

0 commit comments

Comments
 (0)