MCPcopy Index your code
hub / github.com/sqlchat/sqlchat / handleSSLFileInputChange

Function handleSSLFileInputChange

src/components/CreateConnectionModal.tsx:141–166  ·  view source on GitHub ↗
(event: ChangeEvent<HTMLInputElement>)

Source from the content-addressed store, hash-verified

139 };
140
141 const handleSSLFileInputChange = (event: ChangeEvent<HTMLInputElement>) => {
142 const files = event.currentTarget.files;
143 if (!files || files.length === 0) {
144 return;
145 }
146
147 const file = files[0];
148 if (file.type.startsWith("audio/") || file.type.startsWith("video/") || file.type.startsWith("image/")) {
149 toast.error(`Invalid file type:${file.type}`);
150 return;
151 }
152
153 const fr = new FileReader();
154 fr.addEventListener("load", () => {
155 setPartialConnection({
156 ssl: {
157 ...connection.ssl,
158 [selectedSSLField]: fr.result as string,
159 },
160 });
161 });
162 fr.addEventListener("error", () => {
163 toast.error("Failed to read file");
164 });
165 fr.readAsText(file);
166 };
167
168 const handleSSLValueChange = (event: ChangeEvent<HTMLTextAreaElement>) => {
169 setPartialConnection({

Callers

nothing calls this directly

Calls 1

setPartialConnectionFunction · 0.85

Tested by

no test coverage detected