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
|
// 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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user