Return correct error from /images if unauthorized

We retry the request without "/images" suffix on 404 in
GetRepositoryData to see if the problem is lack of authorization, and if
it is, we return a 401 instead of a 404.

Fixes #7892.

Signed-off-by: Donald Huang <don.hcd@gmail.com>