If the port bends you must measure down the CENTER of the port.
Easiest is to make a spreadsheet that subtracts port displacement from the volume based on the size of the port...juggle it around a bit til you have the correct tuning...though IMO if you're off by a couple inches generally you'd never notice the difference unless you're chasing 10ths.
Also worth mentioning is if it's a slot port that runs along a wall of the box you must add 1/2 the port width to length because the wall that continues after the port acts to extend the port. SO where the port ends internally, picture it forming a right triangle extending out a port width.