Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review: use indexOf+slice instead of split+pop in readFileAsBase64

[._.]/ Adam Eivy76e584cc1d9c
diff --git a/client/src/utils/fileUpload.js b/client/src/utils/fileUpload.js
index 1f1ca24446..766d20f9ac 100644
--- a/client/src/utils/fileUpload.js
+++ b/client/src/utils/fileUpload.js
@@ -27,7 +27,8 @@ export function readFileAsBase64(file) {
const reader = new FileReader();
reader.onload = () => {
const result = typeof reader.result === 'string' ? reader.result : '';
- resolve(result.includes(',') ? result.split(',').pop() : result);
+ const commaIndex = result.indexOf(',');
+ resolve(commaIndex !== -1 ? result.slice(commaIndex + 1) : result);
};
reader.onerror = () => reject(new Error(`Failed to read ${file.name}`));
reader.readAsDataURL(file);