Restructured get non-files query to avoid filter.
Revert a63526a970a1fbf54e65898f6fd91cb212a3b7eb to reenable writing.