isExtensionMatching is case insensitive, but not further checks, making those whole function case sensitive, which it should not
This commit is contained in:
@@ -294,15 +294,14 @@ bool sdListFiles(const char * path, const char * extension, const uint8_t maxlen
|
|||||||
|
|
||||||
// TRACE_DEBUG("listSdFiles(%s, %s, %u, %s, %u): fn='%s'; fnExt='%s'; match=%d\n",
|
// TRACE_DEBUG("listSdFiles(%s, %s, %u, %s, %u): fn='%s'; fnExt='%s'; match=%d\n",
|
||||||
// path, extension, maxlen, (selection ? selection : "nul"), flags, fno.fname, (fnExt ? fnExt : "nul"), (fnExt && isExtensionMatching(fnExt, extension)));
|
// path, extension, maxlen, (selection ? selection : "nul"), flags, fno.fname, (fnExt ? fnExt : "nul"), (fnExt && isExtensionMatching(fnExt, extension)));
|
||||||
|
|
||||||
// file validation checks
|
// file validation checks
|
||||||
if (!fnLen || fnLen > maxlen || ( // wrong size
|
if (!fnLen || fnLen > maxlen || ( // wrong size
|
||||||
fnExt && extension && ( // extension-based checks follow...
|
fnExt && extension && ( // extension-based checks follow...
|
||||||
!isExtensionMatching(fnExt, extension) || ( // wrong extension
|
!isExtensionMatching(fnExt, extension) || ( // wrong extension
|
||||||
!(flags & LIST_SD_FILE_EXT) && // only if we want unique file names...
|
!(flags & LIST_SD_FILE_EXT) && // only if we want unique file names...
|
||||||
strcmp(fnExt, getFileExtension(extension)) && // possible duplicate file name...
|
strcasecmp(fnExt, getFileExtension(extension)) && // possible duplicate file name...
|
||||||
isFilePatternAvailable(path, fno.fname, extension, true, tmpExt) && // find the first file from extensions list...
|
isFilePatternAvailable(path, fno.fname, extension, true, tmpExt) && // find the first file from extensions list...
|
||||||
strncmp(fnExt, tmpExt, LEN_FILE_EXTENSION_MAX) // found file doesn't match, this is a duplicate
|
strncasecmp(fnExt, tmpExt, LEN_FILE_EXTENSION_MAX) // found file doesn't match, this is a duplicate
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
|
|||||||
Reference in New Issue
Block a user