Skip to content

Commit

Permalink
fix(initrd): Reverse order of detection
Browse files Browse the repository at this point in the history
Lowercase paths currently resolve to docker links.
By reversing order we can exclude local files by checking for them.
Links will usually be valid.

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
  • Loading branch information
craciunoiuc committed Jul 1, 2024
1 parent d076e5f commit 6f84313
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions initrd/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import (
// New attempts to return the builder for a supplied path which
// will allow the provided ...
func New(ctx context.Context, path string, opts ...InitrdOption) (Initrd, error) {
if builder, err := NewFromOCIImage(ctx, path, opts...); err == nil {
return builder, nil
} else if builder, err := NewFromDockerfile(ctx, path, opts...); err == nil {
if builder, err := NewFromFile(ctx, path, opts...); err == nil {
return builder, nil
} else if builder, err := NewFromDirectory(ctx, path, opts...); err == nil {
return builder, nil
} else if builder, err := NewFromFile(ctx, path, opts...); err == nil {
} else if builder, err := NewFromDockerfile(ctx, path, opts...); err == nil {
return builder, nil
} else if builder, err := NewFromOCIImage(ctx, path, opts...); err == nil {
return builder, nil
}

Expand Down

0 comments on commit 6f84313

Please sign in to comment.