You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
SPIFFSEditor not displaying file contents on ESP32 with LittleFS #1210
Hi,
thanks for this great library. I used it a lot on ESP8266. But now with ESP32 and LittleFS I found that the SPIFFSEditor doesn't display the file contents (only the file names on the left frame).
I got the error message:
[E][vfs_api.cpp:29] open(): myFile.txt does not start with /
The following change (i.e. adding the "/" in front of the filename) fixes this behavior:
This makes the filenames in the left frame of the SPIFFSEditor being displayed as "/index.html" instead of "index.html" and also the subsequent actions like Save, Delete, etc. use then the correct filename including "/".
So from my point of view this could be a real solution.
However I don't yet understand, why it's working in Aircookies fork. So there might be also another solution.
Thank you for finding what seems like a good solution!
Note that at least for my fork/environment, filenames correctly include / as is, so your proposed change makes it //, which appears to work fine, but feels hacky.
My hunch is that the LittleFS library by lorol returns filenames with leading / while the version built into the (recent) ESP32 arduino core does not.
Instead of a define, I just added a check for leading slash to my fork (v2.0.7), seems to work well.
Hi to all.
This has still one problem. The files are correctly edited and viewed in sub-directories when modified edit.htm.gz is used. Unfortunately I was unable to view/edit file using of SPIFFSEditor in subdir.
SOLVED: I just put the path to the li elements of the files in the file list (edited was a copy of the file edit.htm.gz).
I digged a little deeper, to find out, why entry.name() is returning the filename without '/', while on the other hand _fs.open() insists on the '/'. Because in the end, both functions come from the same source module, so I'd expect they should behave consistent: VFSFileImpl::name() VFSFileImpl::open()
name() calls then the function pathToFileName(path()), which is returning only characters after the last '/' in the file path (i.e. it removes the slash).
But there is also another function path() in vfs_api.cpp, which returns the full path and filename including the slash(es).
Activity
blazoncek commentedon Sep 19, 2022
I have noticed the same behaviour, though the fork we use (from @Aircoookie) works correctly on ESP32 but fails on ESP32-S2 and ESP32-S3.
slimline33 commentedon Sep 27, 2022
The same problem here on my esp32 wroom.
the workaround does help!
steff393 commentedon Oct 3, 2022
After I had to introduce that "/" into multiple different places, I searched for a more generic approach:
It now works also, when I only introduce a
here in between line 465 and 466:
ESPAsyncWebServer/src/SPIFFSEditor.cpp
Lines 464 to 468 in f71e3d4
This makes the filenames in the left frame of the SPIFFSEditor being displayed as "/index.html" instead of "index.html" and also the subsequent actions like Save, Delete, etc. use then the correct filename including "/".
So from my point of view this could be a real solution.
However I don't yet understand, why it's working in Aircookies fork. So there might be also another solution.
blazoncek commentedon Oct 3, 2022
@steff393 You may want to use '/' instead of "/".
Aircoookie commentedon Oct 4, 2022
Thank you for finding what seems like a good solution!
Note that at least for my fork/environment, filenames correctly include
/as is, so your proposed change makes it//, which appears to work fine, but feels hacky.My hunch is that the LittleFS library by lorol returns filenames with leading
/while the version built into the (recent) ESP32 arduino core does not.Instead of a define, I just added a check for leading slash to my fork (v2.0.7), seems to work well.
silk-indus commentedon Oct 9, 2022
Hi to all.
This has still one problem. The files are correctly edited and viewed in sub-directories when modified edit.htm.gz is used. Unfortunately I was unable to view/edit file using of SPIFFSEditor in subdir.
SOLVED: I just put the path to the li elements of the files in the file list (edited was a copy of the file edit.htm.gz).
ESP32: Use path() instead of name() to keep '/' before filename (me-n…
steff393 commentedon Oct 10, 2022
I digged a little deeper, to find out, why
entry.name()is returning the filename without '/', while on the other hand_fs.open()insists on the '/'. Because in the end, both functions come from the same source module, so I'd expect they should behave consistent:VFSFileImpl::name()
VFSFileImpl::open()
name()calls then the function pathToFileName(path()), which is returning only characters after the last '/' in the file path (i.e. it removes the slash).But there is also another function
path()in vfs_api.cpp, which returns the full path and filename including the slash(es).Therefore I think the best solution would be:
On my system it works well and I'm going to raise a PR accordingly.
Unfortunately
path()is not existing in ESP8266, so the#ifdefseems necessary.ESP32: Use path() instead of name() to keep '/' before filename (me-n…