Skip to content

Commit d8514ba

Browse files
committed
fix(ProvenanceBasedPostgresStorage): Catch RemoteProvenance
In order to avoid defining database queries, read and write methods now verify `RemoteProvenance` instead of `KnownProvenance`, basically ignoring `LocalProvenance` for now. Signed-off-by: Jens Keim <[email protected]>
1 parent acba794 commit d8514ba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scanner/src/main/kotlin/storages/ProvenanceBasedPostgresStorage.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ class ProvenanceBasedPostgresStorage(
8787
return database.transaction {
8888
val query = table.selectAll()
8989

90+
if (provenance !is RemoteProvenance) {
91+
throw ScanStorageException("Scan result must have a known provenance, but it is $provenance.")
92+
}
93+
9094
when (provenance) {
9195
is ArtifactProvenance -> {
9296
query.andWhere {
@@ -138,7 +142,7 @@ class ProvenanceBasedPostgresStorage(
138142

139143
requireEmptyVcsPath(provenance)
140144

141-
if (provenance !is KnownProvenance) {
145+
if (provenance !is RemoteProvenance) {
142146
throw ScanStorageException("Scan result must have a known provenance, but it is $provenance.")
143147
}
144148

0 commit comments

Comments
 (0)