Handle snapshot repository's missing index.latest

If index.latest does not exist, the repository is on an older
version so simply return the empty repository's generation id.
This commit is contained in:
Ali Beyad 2017-02-24 10:14:22 -05:00
parent 9270f8a873
commit 9a9259184a
1 changed files with 5 additions and 1 deletions

View File

@ -748,7 +748,11 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
} catch (UnsupportedOperationException e) { } catch (UnsupportedOperationException e) {
// If its a read-only repository, listing blobs by prefix may not be supported (e.g. a URL repository), // If its a read-only repository, listing blobs by prefix may not be supported (e.g. a URL repository),
// in this case, try reading the latest index generation from the index.latest blob // in this case, try reading the latest index generation from the index.latest blob
try {
return readSnapshotIndexLatestBlob(); return readSnapshotIndexLatestBlob();
} catch (NoSuchFileException nsfe) {
return RepositoryData.EMPTY_REPO_GEN;
}
} }
} }