Here is a link to where you can get a new charging port: https://www.ifixit.com/Store/Parts/HTC-One-%28M8%29?filters%5BDock+Connectors%5D=on
[https://www.youtube.com/watch?v=_6NSCccjWkE|This] is a video of someone showing the problem, says "solution in description," but the top comment is where you'll find the most in-depth potential solution, "directly from HTC tech support."
[https://www.youtube.com/watch?v=sfyz6-7wuGs|This video] will show you how to get into the phone. I'd recommend using plastic opening tools rather than metal, as plastic is less likely to scratch your screen. He actually mentions the charge port cable at 12:20, and removes it at around 18:40. There you can see where it is, but he does a lot of tape/copper shielding removal before that. Watching the video will tell you how to take the whole thing apart, but if you just need to replace the one part, I found it more confusing than to-the-point. It looks like you'll need to peel up the copper shielding from the left side until you can see that whole piece of tape keeping the charge port cable in place, and then peel up that piece of tape, carefully disconnect the charge port cable from the board, and work from there to free anything else that might be in the way. The key here is to mind the adhesive, and the digitizer cable which is also under the same piece of tape. As with a guide, follow the steps you took in reverse order to install the new part.
Also, since there is no guide, I'd recommend documenting what you do (if you do end up replacing the charge port) and posting it on that device's page as a guide so that others can use your experience to repair their things.
Good luck!