mirror of
https://github.com/safing/portbase
synced 2025-09-07 13:10:02 +00:00
Improve empty index support
This commit is contained in:
parent
0d5dc62b9c
commit
e02f084c8a
2 changed files with 23 additions and 23 deletions
|
@ -132,7 +132,7 @@ func (reg *ResourceRegistry) loadIndexFile(idx Index) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(releases) == 0 {
|
if len(releases) == 0 {
|
||||||
log.Warningf("%s: index %s is empty", reg.Name, idx.Path)
|
log.Debugf("%s: index %s is empty", reg.Name, idx.Path)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,11 +59,8 @@ func (reg *ResourceRegistry) downloadIndex(ctx context.Context, client *http.Cli
|
||||||
return fmt.Errorf("failed to parse index %s: %w", idx.Path, err)
|
return fmt.Errorf("failed to parse index %s: %w", idx.Path, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for content
|
// Add index data to registry.
|
||||||
if len(newIndexData) == 0 {
|
if len(newIndexData) > 0 {
|
||||||
return fmt.Errorf("index %s is empty", idx.Path)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if all resources are within the indexes' authority.
|
// Check if all resources are within the indexes' authority.
|
||||||
authoritativePath := path.Dir(idx.Path) + "/"
|
authoritativePath := path.Dir(idx.Path) + "/"
|
||||||
if authoritativePath == "./" {
|
if authoritativePath == "./" {
|
||||||
|
@ -84,6 +81,9 @@ func (reg *ResourceRegistry) downloadIndex(ctx context.Context, client *http.Cli
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warningf("%s: failed to add resources: %s", reg.Name, err)
|
log.Warningf("%s: failed to add resources: %s", reg.Name, err)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.Debugf("%s: index %s is empty", reg.Name, idx.Path)
|
||||||
|
}
|
||||||
|
|
||||||
// check if dest dir exists
|
// check if dest dir exists
|
||||||
indexDir := filepath.FromSlash(path.Dir(idx.Path))
|
indexDir := filepath.FromSlash(path.Dir(idx.Path))
|
||||||
|
|
Loading…
Add table
Reference in a new issue