21099 api serverside validation check
This commit is contained in:
@@ -1087,7 +1087,7 @@ export const RenderFileUpload = (field) => {
|
||||
setRejectedFiles([]); // Clear any previously rejected file errorsss
|
||||
};
|
||||
|
||||
const FILENAME_ALLOWED = /^[A-Za-z0-9 ._\-()]+$/;
|
||||
const FILENAME_ALLOWED = /^[A-Za-z0-9 ._\-:()]+$/;
|
||||
|
||||
const validateFilename = (file, t) => {
|
||||
const name = file.name;
|
||||
@@ -1112,8 +1112,8 @@ export const RenderFileUpload = (field) => {
|
||||
};
|
||||
}
|
||||
|
||||
// block characters < > : " / \ | ? *
|
||||
if (/[<>:"/\\|?*]/.test(name)) {
|
||||
// block characters < > " / \ | ? *
|
||||
if (/[<>"/\\|?*]/.test(name)) {
|
||||
return {
|
||||
code: "filename-invalid-chars",
|
||||
message: `${name} ${t(
|
||||
|
||||
@@ -2175,7 +2175,7 @@ const RenderFileUpload = (field) => {
|
||||
setRejectedFiles([]); // Clear any previously rejected file errorsss
|
||||
};
|
||||
|
||||
const FILENAME_ALLOWED = /^[A-Za-z0-9 ._\-()]+$/;
|
||||
const FILENAME_ALLOWED = /^[A-Za-z0-9 ._\-:()]+$/;
|
||||
|
||||
const validateFilename = (file, t) => {
|
||||
const name = file.name;
|
||||
@@ -2190,7 +2190,6 @@ const RenderFileUpload = (field) => {
|
||||
};
|
||||
}
|
||||
|
||||
// broader blocklist (optional but recommended)
|
||||
if (!FILENAME_ALLOWED.test(name)) {
|
||||
return {
|
||||
code: "filename-invalid-chars",
|
||||
@@ -2200,8 +2199,8 @@ const RenderFileUpload = (field) => {
|
||||
};
|
||||
}
|
||||
|
||||
// block characters < > : " / \ | ? *
|
||||
if (/[<>:"/\\|?*]/.test(name)) {
|
||||
// block characters < > " / \ | ? *
|
||||
if (/[<>"/\\|?*]/.test(name)) {
|
||||
return {
|
||||
code: "filename-invalid-chars",
|
||||
message: `${name} ${t(
|
||||
|
||||
Reference in New Issue
Block a user