mirror of
https://github.com/HeyPuter/puter.git
synced 2025-01-23 22:40:20 +08:00
fix issue with empty file associations input breaking the save process in Dev Center
This commit is contained in:
parent
ce36a685fc
commit
2061d571b0
@ -1166,30 +1166,29 @@ $(document).on('click', '.edit-app-save-btn', async function (e) {
|
||||
}
|
||||
|
||||
// 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);
|
||||
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
|
||||
if (fileType.includes("/")) {
|
||||
return lower;
|
||||
} else if (fileType.includes(".")) {
|
||||
return "." + lower.split(".")[1];
|
||||
} else {
|
||||
return "." + lower;
|
||||
}
|
||||
}).filter(Boolean);
|
||||
}
|
||||
const lower = fileType.toLocaleLowerCase();
|
||||
|
||||
if (fileType.includes("/")) {
|
||||
return lower;
|
||||
} else if (fileType.includes(".")) {
|
||||
return "." + lower.split(".")[1];
|
||||
} else {
|
||||
return "." + lower;
|
||||
}
|
||||
}).filter(Boolean);
|
||||
|
||||
// error?
|
||||
if (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user