Use the 'ref/images/' ref in the image URL rather than the commit ID

This makes the resolution of the URL faster since the read access right
can be checked for this ref rather than finding all refs that contain
the commit ID and then checking the read access right on those refs.

Change-Id: I9bb45d75ddca6955d2584d8085b31999be07c193
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/imagare/PostImage.java b/src/main/java/com/googlesource/gerrit/plugins/imagare/PostImage.java
index 33470ef..5abfc5c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/imagare/PostImage.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/imagare/PostImage.java
@@ -142,7 +142,7 @@
       ObjectId commitId = repo.resolve(ref);
       if (commitId != null) {
         // this image exists already
-        return getUrl(pc.getProject().getNameKey(), commitId.getName(), fileName);
+        return getUrl(pc.getProject().getNameKey(), ref, fileName);
       }
 
       RevWalk rw = new RevWalk(repo);
@@ -183,7 +183,7 @@
                 pc.getProject().getName(), ru.getResult()));
           }
 
-          return getUrl(pc.getProject().getNameKey(), commitId.getName(), fileName);
+          return getUrl(pc.getProject().getNameKey(), ref, fileName);
         } finally {
           oi.release();
         }