Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03b11e9703 |
@@ -297,17 +297,18 @@ func (c *Cache) LookupSource(
|
|||||||
|
|
||||||
key := req.Source.Key()
|
key := req.Source.Key()
|
||||||
|
|
||||||
var rowExists bool
|
var foundKey string
|
||||||
|
|
||||||
err := c.db.QueryRowContext(ctx, `
|
err := c.db.QueryRowContext(ctx, `
|
||||||
SELECT EXISTS(SELECT 1 FROM source_content WHERE source_key = ?)
|
SELECT source_key FROM source_content WHERE source_key = ?
|
||||||
`, string(key)).Scan(&rowExists)
|
`, string(key)).Scan(&foundKey)
|
||||||
if err != nil {
|
|
||||||
return "", fmt.Errorf("failed to lookup source: %w", err)
|
if errors.Is(err, sql.ErrNoRows) {
|
||||||
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if !rowExists {
|
if err != nil {
|
||||||
return "", nil
|
return "", fmt.Errorf("failed to lookup source: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify the content file exists
|
// Verify the content file exists
|
||||||
|
|||||||
Reference in new issue
Block a user