fix prefix handling for staticfiles panel, refs #503

See issue #503 for details. I'm not that happy with the test case, because it 'mirrors' the actual code, please review