Since I updated from 18.0 to the latest 21 version, Previews are not working well. Browsing image folders will get empty thumbnails, spawning hundreds of errors like this:
"Exception":"Error","Message":"file_get_contents(/ncdata/appdata_435c912d3565e/preview/88282/256-256-crop.jpg): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#274"
If I refresh more, the previews do get generated eventually.
I’m using the Preview generator app, and I thought it’s a problem there, but since I learned that this app does nothing else but trigger generation for each file (so it doesn’t generate itself) I think the issue is with actually with NextCloud. The same errors come when I’m trying to pregenerate previews with the app.
The problem was that when I wanted to regenerate previews, I simply erased the contents of appdata_XXX/preview. Every preview file is also stored in the DB so this alone causes problems. On one hand NC will not find the previews it thought to exist, on the other PreviewGenerator will not generate new files (as it’s thought to exist as per db).
So anyone finding this issue - if you want to clear previews, either:
delete the preview folder contents, then run occ files:scan-app-data - this syncs files/db
faster/riskier: delete the contents of the DB with SQL like delete from oc_filecache where path like 'appdata_ocpb8d7vbr73/preview/%';