added logic to skip extraction of the path if it is simply the common prefix

Maybe I'm not understanding what is happening here, but this seems like a simple fix.