GCS_MAVLink: FTP: strip trailing / in dir list request

This commit is contained in:
Iampete1 2024-02-20 18:42:05 +00:00 committed by Andrew Tridgell
parent 785e0c4c62
commit a9eadd9f01

View File

@ -624,6 +624,12 @@ void GCS_MAVLINK::ftp_list_dir(struct pending_ftp &request, struct pending_ftp &
request.data[sizeof(request.data) - 1] = 0; // ensure the path is null terminated
// Strip trailing /
const size_t dir_len = strlen((char *)request.data);
if ((dir_len > 1) && (request.data[dir_len - 1] == '/')) {
request.data[dir_len - 1] = 0;
}
// open the dir
auto *dir = AP::FS().opendir((char *)request.data);
if (dir == nullptr) {