| ... | ... |
@@ -151,14 +151,20 @@ func (store *TagStore) Get(repoName string) (Repository, error) {
|
| 151 | 151 |
return nil, nil |
| 152 | 152 |
} |
| 153 | 153 |
|
| 154 |
-func (store *TagStore) GetImage(repoName, tag string) (*Image, error) {
|
|
| 154 |
+func (store *TagStore) GetImage(repoName, tagOrId string) (*Image, error) {
|
|
| 155 | 155 |
repo, err := store.Get(repoName) |
| 156 | 156 |
if err != nil {
|
| 157 | 157 |
return nil, err |
| 158 | 158 |
} else if repo == nil {
|
| 159 | 159 |
return nil, nil |
| 160 | 160 |
} |
| 161 |
- if revision, exists := repo[tag]; exists {
|
|
| 161 |
+ //go through all the tags, to see if tag is in fact an ID |
|
| 162 |
+ for _, revision := range repo {
|
|
| 163 |
+ if utils.TruncateId(revision) == tagOrId {
|
|
| 164 |
+ return store.graph.Get(revision) |
|
| 165 |
+ } |
|
| 166 |
+ } |
|
| 167 |
+ if revision, exists := repo[tagOrId]; exists {
|
|
| 162 | 168 |
return store.graph.Get(revision) |
| 163 | 169 |
} |
| 164 | 170 |
return nil, nil |