Skip to content

Commit

Permalink
as: Fix GLS package data merging
Browse files Browse the repository at this point in the history
  • Loading branch information
cvetkovski98 committed Jun 27, 2023
1 parent 3235876 commit 4dab46d
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions pkg/applicationserver/io/packages/loragls/v3/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,23 +415,28 @@ func (*GeolocationPackage) mergePackageData(
return nil, err
}
}
var merged Data
for _, data := range []*Data{
&defaultData,
&associationData,
} {
if data.Query != 0 {
merged.Query = data.Query
}
if data.ServerURL != nil {
merged.ServerURL = urlutil.CloneURL(data.ServerURL)
}
if data.Token != "" {
merged.Token = data.Token
}
if len(data.RecentMetadata) > 0 {
merged.RecentMetadata = data.RecentMetadata
}

merged := Data{
Query: defaultData.Query,
MultiFrame: defaultData.MultiFrame,
MultiFrameWindowSize: defaultData.MultiFrameWindowSize,
MultiFrameWindowAge: defaultData.MultiFrameWindowAge,
ServerURL: defaultData.ServerURL,
Token: defaultData.Token,
RecentMetadata: defaultData.RecentMetadata,
}

if associationData.Query != 0 {
merged.Query = associationData.Query
}
if associationData.ServerURL != nil {
merged.ServerURL = urlutil.CloneURL(associationData.ServerURL)
}
if associationData.Token != "" {
merged.Token = associationData.Token
}
if len(associationData.RecentMetadata) > 0 {
merged.RecentMetadata = associationData.RecentMetadata
}
if merged.ServerURL == nil {
merged.ServerURL = urlutil.CloneURL(api.DefaultServerURL)
Expand Down

0 comments on commit 4dab46d

Please sign in to comment.