Open xmcp opened 1 year ago
To fix this issue, apart from patching LocalFileStorage.get_files
, the method LocalFileStorage.path_exists
also needs to return True for broken symlinks. I can open a PR for this if needed.
I agree that we should handle this case better. We're currently preparing Flask-Admin as a pallets-eco project, but I think after that a PR would be helpful.
Step to reproduce:
Step 1. Create a broken symbolic link:
Step 2. Serve this directory with FileAdmin:
Step 3. Visit
http://127.0.0.1:5432/admin/fileadmin/
Actual Behavior:
It shows HTTP 500 Internal Server Error page with this exception in STDOUT:
Expected Behavior:
It should not show HTTP 500 page when fails to get the file size and mtime. Instead it should falls back with some value (e.g., 0).
Background:
I come across this issue when deleting a symlinked file in FileAdmin. Say that a directory has a file A that is symlinked to file B, and I delete file B, it will immediately show HTTP 500, preventing me to perform any action in this directory. Therefore I have to carefully delete A before B.