@@ -16,7 +16,7 @@ void WebServerClass::init()
1616 Serial.println (" [Storage] Couldn't mount file system." );
1717 return ;
1818 }
19-
19+
2020 on (" /edit" , HTTP_GET, [&]()
2121 {
2222 if (!handleFileRead (" /edit.htm" ))
@@ -32,7 +32,7 @@ void WebServerClass::init()
3232 });
3333 on (" /edit" , HTTP_PUT, _handle_file_create);
3434 on (" /edit" , HTTP_DELETE, _handle_file_delete);
35- on (" /edit" , HTTP_POST, [&](){ send (200 , " text/plain" , " " ); }, _handle_file_upload);
35+ on (" /edit" , HTTP_POST, [&]() { send (200 , " text/plain" , " " ); }, _handle_file_upload);
3636 on (" /list" , HTTP_GET, _handle_file_list);
3737 on (" /update" , HTTP_GET, [&]()
3838 {
@@ -64,7 +64,7 @@ void WebServerClass::init()
6464 send (404 , " text/plain" , " Oops, file not found!" );
6565 }
6666 });
67-
67+
6868 begin ();
6969}
7070
@@ -106,7 +106,7 @@ String WebServerClass::getContentType(String filename)
106106bool WebServerClass::handleFileRead (String path)
107107{
108108 Serial.println (" [Storage] File read: " + path);
109-
109+
110110 webserverBusy = true ;
111111 if (path.endsWith (" /" )) path += " index.htm" ;
112112 String contentType = getContentType (path);
@@ -135,7 +135,7 @@ void WebServerClass::handleFileUpload()
135135 return ;
136136
137137 HTTPUpload& _upload = upload ();
138-
138+
139139 if (_upload.status == UPLOAD_FILE_START)
140140 {
141141 String filename = _upload.filename ;
@@ -148,7 +148,6 @@ void WebServerClass::handleFileUpload()
148148 }
149149 else if (_upload.status == UPLOAD_FILE_WRITE)
150150 {
151- // Serial.print("[Storage] Receiving..." + _upload.currentSize);
152151 if (fsUploadFile)
153152 fsUploadFile.write (_upload.buf , _upload.currentSize );
154153 }
@@ -164,17 +163,17 @@ void WebServerClass::handleFileDelete()
164163{
165164 if (args () == 0 )
166165 return send (500 , " text/plain" , " BAD ARGS" );
167-
166+
168167 String path = arg (0 );
169168 Serial.println (" [Storage] Deleting file: " + path);
170-
169+
171170 if (path == " /" )
172171 return send (500 , " text/plain" , " BAD PATH" );
173172 if (!SPIFFS.exists (path))
174173 return send (404 , " text/plain" , " Oops, file not found (3)!" );
175-
174+
176175 SPIFFS.remove (path);
177-
176+
178177 send (200 , " text/plain" , " " );
179178 path = String ();
180179}
@@ -183,22 +182,22 @@ void WebServerClass::handleFileCreate()
183182{
184183 if (args () == 0 )
185184 return send (500 , " text/plain" , " BAD ARGS" );
186-
185+
187186 String path = arg (0 );
188187 Serial.println (" [Storage] Creating file: " + path);
189-
188+
190189 if (path == " /" )
191190 return send (500 , " text/plain" , " BAD PATH" );
192191 if (SPIFFS.exists (path))
193192 return send (500 , " text/plain" , " File already exists!" );
194-
193+
195194 File file = SPIFFS.open (path, " w" );
196-
195+
197196 if (file)
198197 file.close ();
199198 else
200199 return send (500 , " text/plain" , " Oops, creating file failed!" );
201-
200+
202201 send (200 , " text/plain" , " " );
203202 path = String ();
204203}
@@ -210,7 +209,7 @@ void WebServerClass::handleFileList()
210209 send (500 , " text/plain" , " BAD ARGS" );
211210 return ;
212211 }
213-
212+
214213 String path = arg (" dir" );
215214 Dir dir = SPIFFS.openDir (path);
216215 path = String ();
0 commit comments