Photons always travel in a straight line: it's just the medium they travel in that gets curved. For example, if you take a ribbon, stretch it out straight, and draw a straight line from one end to another, that line is straight: however, you can curl up the ribbon, making the straight line seem curved.
(An aside: photons move in a straight line due to interference. As quantum objects, they also appear as a wave: and if you have a wavelength V, and a wavelength W, where W appears the same as V only shifted half a wavelength so that the shape that goes above the line in V is underneath it in W, when V and W meet, they cancel each other out.
Photons take every possible path from A to B, but when one goes one way, one can go the other way in the exact same way and deviating only half a wavelength: one would be V, and one would be W. A similar path can be found for every single wavelength that goes for any more than the minimum possible distance from A to B: that minimum can only be achieved one way, so it can't be cancelled out, and that one way is clearly a straight line).
This is very complex, sorry. I don't know if this has been formalized in this time, it's a consequence of the relationship between the medium light moves in, and the strings of the spatial dimension.