Removed problematic if statement (#5180)

This if statement was causing the value of option.AllowedOrigins to be always equal to "*". Now the values in the config file will be used when present. This allows for people who don't need this feature to not update their security.toml files.
This commit is contained in:
jerebear12 2024-01-08 13:35:20 -06:00 committed by GitHub
parent 121c59e2b7
commit 8c966ac23b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -111,11 +111,9 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption)
v.SetDefault("cors.allowed_origins.values", "*") v.SetDefault("cors.allowed_origins.values", "*")
if (option.AllowedOrigins == nil) || (len(option.AllowedOrigins) == 0) {
allowedOrigins := v.GetString("cors.allowed_origins.values") allowedOrigins := v.GetString("cors.allowed_origins.values")
domains := strings.Split(allowedOrigins, ",") domains := strings.Split(allowedOrigins, ",")
option.AllowedOrigins = domains option.AllowedOrigins = domains
}
fs = &FilerServer{ fs = &FilerServer{
option: option, option: option,