@@ -913,9 +913,7 @@ static void handleAbout(HTTPRequest *req, HTTPResponse * res) {
913913 res->print (page);
914914 page.clear ();
915915
916- esp_chip_info_t ci;
917- esp_chip_info (&ci);
918- page += keyValue (" Cores" , String (ci.cores ));
916+ page += keyValue (" Cores" , ESP.getChipCores ());
919917 page += keyValue (" CPU frequency" , ESP.getCpuFreqMHz (), " MHz" );
920918
921919 page += keyValue (" SPIFFS size" , ObsUtils::toScaledByteString (SPIFFS.totalBytes ()));
@@ -1601,7 +1599,7 @@ static void handleFlashFileUpdateAction(HTTPRequest *req, HTTPResponse *res) {
16011599static void handleDeleteFiles (HTTPRequest *req, HTTPResponse * res) {
16021600 const auto params = extractParameters (req);
16031601 String path = getParameter (params, " path" );
1604- if (path != " trash" ) {
1602+ if (path != " / trash" ) {
16051603 SD.mkdir (" /trash" );
16061604 }
16071605 bool moveToRoot = !getParameter (params, " move" ).isEmpty ();
@@ -1617,7 +1615,7 @@ static void handleDeleteFiles(HTTPRequest *req, HTTPResponse * res) {
16171615 if (param.first == " delete" ) {
16181616 String file = param.second ;
16191617
1620- String fullName = path + (path.length () > 1 ? " / " : " " ) + file;
1618+ String fullName = path + (path.endsWith ( " / " ) ? " " : " / " ) + file;
16211619
16221620 html += ObsUtils::encodeForXmlText (file) + " ➜ " ;
16231621 if (moveToRoot) {
@@ -1679,6 +1677,10 @@ static void handleSd(HTTPRequest *req, HTTPResponse *res) {
16791677 displayTest->showTextOnGrid (0 , 3 , " Path:" );
16801678 displayTest->showTextOnGrid (1 , 3 , path);
16811679
1680+ if (!path.endsWith (" /" )) {
1681+ path += " /" ;
1682+ }
1683+
16821684// Iterate over directories
16831685 File child = file.openNextFile ();
16841686 uint16_t counter = 0 ;
@@ -1690,7 +1692,6 @@ static void handleSd(HTTPRequest *req, HTTPResponse *res) {
16901692 TimeUtils::dateTimeToString (child.getLastWrite ())
16911693 + " - " + ObsUtils::toScaledByteString (child.size ()));
16921694
1693- fileName = fileName.substring (int (fileName.lastIndexOf (" /" ) + 1 ));
16941695 fileName = ObsUtils::encodeForXmlAttribute (fileName);
16951696 bool isDirectory = child.isDirectory ();
16961697 html +=
@@ -1700,7 +1701,7 @@ static void handleSd(HTTPRequest *req, HTTPResponse *res) {
17001701 + " <input class='small' type='checkbox' value='" + fileName + " ' name='delete'"
17011702 + String (isDirectory ? " disabled" : " " )
17021703 + " ><a href=\" /sd?path="
1703- + String (child.name ())
1704+ + path + String (child.name ())
17041705 + " \" >"
17051706 + String (isDirectory ? " 📁" : " 📄" )
17061707 + fileName
@@ -1726,7 +1727,8 @@ static void handleSd(HTTPRequest *req, HTTPResponse *res) {
17261727 html += " </ul>" ;
17271728
17281729 if (path != " /" ) {
1729- String back = path.substring (0 , path.lastIndexOf (' /' ));
1730+ String back = path.substring (
1731+ 0 , path.lastIndexOf (' /' , path.length () - 2 ));
17301732 if (back.isEmpty ()) {
17311733 back = " /" ;
17321734 }
@@ -1738,12 +1740,12 @@ static void handleSd(HTTPRequest *req, HTTPResponse *res) {
17381740 }
17391741
17401742 if (counter > 0 ) {
1741- if (path == " /uploaded" ) {
1743+ if (path == " /uploaded/ " ) {
17421744 html += " <hr /><p>Move for new upload will move selected files to the root directory, where "
17431745 " they will be considered as new tracks and uploaded to the portal with the next "
17441746 " Track upload.</p><input type='submit' class='btn' name='move' value='Move for new upload' />" ;
17451747 }
1746- if (path == " /trash" ) {
1748+ if (path == " /trash/ " ) {
17471749 html += " <hr /><input type='submit' class='btn' value='Delete Selected' />" ;
17481750 } else {
17491751 html += " <hr /><input type='submit' class='btn' value='Move to Trash' />" ;
0 commit comments