Skip to content

Commit

Permalink
BUG/MINOR: maps: fix sanitizing the filenames after id check
Browse files Browse the repository at this point in the history
  • Loading branch information
mjuraga committed Oct 12, 2023
1 parent 7d7cba7 commit 6ebe3d2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions runtime/runtime_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,13 @@ func (c *client) IsVersionBiggerOrEqual(minimumVersion HAProxyVersion) bool {

// GetMapsPath returns runtime map file path or map id
func (c *client) GetMapsPath(name string) (string, error) {
name = misc.SanitizeFilename(name)

// we can refer to runtime map with either id or path
if strings.HasPrefix(name, "#") { // id
return name, nil
}
// if not id then sanitize filename
name = misc.SanitizeFilename(name)

// CLI
if c.options.MapsDir != nil && *c.options.MapsDir != "" {
ext := filepath.Ext(name)
Expand Down

0 comments on commit 6ebe3d2

Please sign in to comment.