Skip to content

Commit

Permalink
daemon: make sure to compare language and aliases in lower case
Browse files Browse the repository at this point in the history
Signed-off-by: Denys Smirnov <denys@sourced.tech>
  • Loading branch information
Denys Smirnov authored and dennwc committed May 28, 2019
1 parent 1014e29 commit caa85f8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func (d *Daemon) RemoveDriver(language string) error {
}

func (d *Daemon) DriverPool(ctx context.Context, language string) (*DriverPool, error) {
language = strings.ToLower(language)
d.mu.RLock()
if l, ok := d.aliases[language]; ok {
language = l
Expand Down Expand Up @@ -168,13 +169,14 @@ func (d *Daemon) DriverPool(ctx context.Context, language string) (*DriverPool,
}

func driverWithLang(lang string, list []*runtime.DriverImageStatus) *runtime.DriverImageStatus {
lang = strings.ToLower(lang)
for _, d := range list {
m := d.Manifest
if m.Language == lang {
if strings.ToLower(m.Language) == lang {
return d
}
for _, l := range m.Aliases {
if l == lang {
if strings.ToLower(l) == lang {
return d
}
}
Expand Down Expand Up @@ -235,7 +237,7 @@ func (d *Daemon) newDriverPool(rctx context.Context, language string, aliases []
d.pool[language] = dp
for _, l := range aliases {
logrus.Debugf("language alias: %s = %s", language, l)
d.aliases[l] = language
d.aliases[strings.ToLower(l)] = language
}
return dp, nil
}
Expand Down

0 comments on commit caa85f8

Please sign in to comment.