Gravitational lensing (GL), first mooted in 1924, is now a technique being used by astronomers to detect dark matter. Lensing depends on the bending of light by the gravity of a mass concentration, such as a galaxy or galaxy cluster. In glass, it is the spatial gradient of the optical path length that causes lensing. There is no lensing of light passing through a uniform parallel-sided glass slab. With gravitation, I imagine that it is the spatial gradient of the integrated gravitational potential along the optical path that causes lensing. If I'm right, there can be no GL of light passing through a uniform distribution of dark matter (or energy, which also generates a gravitational potential). Does this mean that the density of dark matter can only be measured from the distortion of galaxy shapes behind concentrated objects like galaxy clusters, and nowhere else? Might any estimate of the overall density of dark matter obtained from weak lensing measurements then be only a lower limit? And how do we know that the dark matter recently detected is not in fact dark energy, or a mixture of the two? Or have I got it all wrong?