From fe85c512f25d40872c7c8fcbf53130157a991bcd Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Tue, 9 Apr 2024 03:36:19 +0100 Subject: [PATCH] Archive: Fix .txt file type for /any paths --- applications/main/archive/helpers/archive_files.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/applications/main/archive/helpers/archive_files.c b/applications/main/archive/helpers/archive_files.c index 10b89c3b5c..3406ceea90 100644 --- a/applications/main/archive/helpers/archive_files.c +++ b/applications/main/archive/helpers/archive_files.c @@ -36,7 +36,13 @@ void archive_set_file_type(ArchiveFile_t* file, const char* path, bool is_folder txt_path = archive_get_default_path(ArchiveTabBadKb); break; } - if(txt_path != NULL && furi_string_start_with_str(file->path, txt_path)) { + if(txt_path != NULL) { + size_t len = strlen(txt_path); + if(furi_string_size(file->path) < len) continue; + // Compare but ignore /ext or /any, continue if different (memcmp() != 0) + if(memcmp(furi_string_get_cstr(file->path) + 4, txt_path + 4, len - 4)) { + continue; + } file->type = i; return; }