diff --git a/FtpServer.cpp b/FtpServer.cpp index 0aaf6b3..2b981dd 100644 --- a/FtpServer.cpp +++ b/FtpServer.cpp @@ -282,7 +282,7 @@ uint8_t FtpServer::handleFTP() { void FtpServer::clientConnected() { - DEBUG_PRINTLN( F(" Client connected!") ); + DEBUG_PRINTLN( F(" Client connected!") ); client.print(F("220---")); client.print(welcomeMessage); client.println(F(" ---")); client.println(F("220--- By Renzo Mischianti ---")); client.print(F("220 -- Version ")); client.print(FTP_SERVER_VERSION); client.println(F(" --")); @@ -1409,7 +1409,7 @@ bool FtpServer::doList() // data.println( fileDir.name() ); String fn = fileDir.name(); - fn.remove(0, fn.lastIndexOf("/")+1); + if (fn[0]=='/') { fn.remove(0, fn.lastIndexOf("/")+1); } generateFileLine(&data, fileDir.isDirectory(), fn.c_str(), long( fileDir.size()), "Jan 01 00:00", this->user); @@ -1427,7 +1427,10 @@ bool FtpServer::doList() // } // data.println( dir.fileName() ); - generateFileLine(&data, dir.isDir(), dir.fileName(), long( dir.fileSize()), "Jan 01 00:00", this->user); + String fn = dir.fileName(); + if (fn[0]=='/') { fn.remove(0, fn.lastIndexOf("/")+1); } + + generateFileLine(&data, dir.isDir(), fn.c_str(), long( dir.fileSize()), "Jan 01 00:00", this->user); nbMatch ++; return true; diff --git a/FtpServer.h b/FtpServer.h index aee4aca..51254e3 100644 --- a/FtpServer.h +++ b/FtpServer.h @@ -20,7 +20,7 @@ #ifndef FTP_SERVER_H #define FTP_SERVER_H -#define FTP_SERVER_VERSION "2022-03-11" +#define FTP_SERVER_VERSION "2.1.2 (2022-07-06)" #if ARDUINO >= 100 #include "Arduino.h" diff --git a/README.md b/README.md index 2421a31..954ef77 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ - Wio Terminal (SdFat 2, Seed SD, and native FAT) #### Changelog -- 2022-05-21 2.1.1 Minor fix +- 2022-05-21 2.1.2 Fix SD path (#19) +- 2022-05-21 2.1.1 Minor fix - 2022-03-30 2.1.0 Add UTF8 support and enabled It by default (Thanks to @plaber) - 2022-03-30 2.0.0 Complete support for STM32 with SD and SPI Flash minor bux fix and HELP command support - 2022-03-17 1.3.0 Fix enc28j60 and w5500 support and restructuring for local settings diff --git a/library.json b/library.json index 49ef43c..735193b 100644 --- a/library.json +++ b/library.json @@ -16,6 +16,6 @@ }, "url": "https://www.mischianti.org", "frameworks": "Arduino", - "version": "2.1.1", + "version": "2.1.2", "platforms": "*" } diff --git a/library.properties b/library.properties index a4654e7..81de60b 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=SimpleFTPServer -version=2.1.1 +version=2.1.2 author=Renzo Mischianti maintainer=Renzo Mischianti sentence=Simple FTP server for esp8266, esp32 and Arduino