mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
fix: media upload security hardening from 6-agent review
- uploadCount: always decrement in finally (prevent permanent uploading state) - AbortSignal: pass to actual HTTP request (cancel network, not just UI) - Concurrent uploads: use Set<AbortController> instead of single ref - DOMPurify hooks: scope inside sanitizeHtml() to avoid global pollution - Video src: restrict to HTTPS only (was allowing HTTP) - GIF: remove from accept attributes (backend rejects GIF) - Ref mutation: move handleMediaUploadRef update to useEffect
This commit is contained in:
@@ -58,13 +58,13 @@ export const newsApi = {
|
||||
return response.data;
|
||||
},
|
||||
|
||||
uploadMedia: async (file: File): Promise<NewsMediaUploadResponse> => {
|
||||
uploadMedia: async (file: File, signal?: AbortSignal): Promise<NewsMediaUploadResponse> => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const response = await apiClient.post<NewsMediaUploadResponse>(
|
||||
'/cabinet/admin/news/media/upload',
|
||||
formData,
|
||||
{ headers: { 'Content-Type': 'multipart/form-data' } },
|
||||
{ headers: { 'Content-Type': 'multipart/form-data' }, signal },
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user