GCS_MAVLink: FTP: strip trailing /
in dir list request
This commit is contained in:
parent
785e0c4c62
commit
a9eadd9f01
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user