Fixing bug with logging middleware which was causing problems with legacy file upload