[#2065] Fix getSegmentsFromRealPath to raise error for path ouside of root.