fix issue with empty file associations input breaking the save process in Dev Center

This commit is contained in:
jelveh 2024-12-14 13:26:52 -08:00
parent ce36a685fc
commit 2061d571b0

View File

@ -1166,30 +1166,29 @@ $(document).on('click', '.edit-app-save-btn', async function (e) {
} }
// parse filetype_associations // parse filetype_associations
if(filetype_associations !== ''){
filetype_associations = JSON.parse(filetype_associations);
filetype_associations = filetype_associations.map((type) => {
const fileType = type.value;
if (
!fileType ||
fileType === "." ||
fileType === "/"
) {
error = `<strong>File Association Type</strong> must be valid.`;
return null; // Return null for invalid cases
}
const lower = fileType.toLocaleLowerCase();
filetype_associations = JSON.parse(filetype_associations); if (fileType.includes("/")) {
filetype_associations = filetype_associations.map((type) => { return lower;
const fileType = type.value; } else if (fileType.includes(".")) {
return "." + lower.split(".")[1];
} else {
if ( return "." + lower;
!fileType || }
fileType === "." || }).filter(Boolean);
fileType === "/"
) {
error = `<strong>File Association Type</strong> must be valid.`;
return null; // Return null for invalid cases
} }
const lower = fileType.toLocaleLowerCase();
if (fileType.includes("/")) {
return lower;
} else if (fileType.includes(".")) {
return "." + lower.split(".")[1];
} else {
return "." + lower;
}
}).filter(Boolean);
// error? // error?
if (error) { if (error) {