Merge pull request #14348 from Staars/patch-5

xdrv_50_filesystem.ino - adjust file size automatically
This commit is contained in:
Theo Arends 2022-01-09 18:45:35 +01:00 committed by GitHub
commit d2bf4e9f2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -348,6 +348,11 @@ bool TfsLoadFile(const char *fname, uint8_t *buf, uint32_t len) {
AddLog(LOG_LEVEL_INFO, PSTR("TFS: File '%s' not found"), fname +1); // Skip leading slash
return false;
}
size_t flen = file.size();
if (len > flen){
len = flen;
}
file.read(buf, len);
file.close();