JM-Lemmi / ical-relay

Relay ical urls and edit them on the fly with different modules.
GNU Affero General Public License v3.0
9 stars 2 forks source link

`dbReadProfile` finds filters by matching on `filter.id` in the database, but `dbAddRuleFilter` stores the ruleId in `filter.rule` #255

Open frereit opened 2 months ago

frereit commented 2 months ago

When using --import-data (and possible other code paths leading to dbAddRuleFilter), the rule id this filter belongs to is stored in the rule field of the filter table:

https://github.com/JM-Lemmi/ical-relay/blob/ea4ce9485c216f6c438c3250123f4ae9541c9d26/pkg/datastore/database.go#L445-L447

However, when retrieving a rule, only filters where the id of the filter in the database matches the rule are returned:

https://github.com/JM-Lemmi/ical-relay/blob/ea4ce9485c216f6c438c3250123f4ae9541c9d26/pkg/datastore/database.go#L205-L206

This mismatch causes at least --import-data to fail. Simply changing the SELECT statement to match on rule = $1 instead works, but I'm unsure if this doesn't break other parts of the codebase which store the rule id in the id field of filter.