core: fix truncated prefix when filters are toggled (bug #40204)