Skip to content

Commit

Permalink
fix id search returning results for invalid queries.
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Jul 5, 2024
1 parent 21250f8 commit e11b7ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

### Bug fixes

- [ ] htmx search for id or uuid, incomplete (less than 32 chars) uuid should not trigger a search.
- [X] htmx search for id or uuid, incomplete (less than 32 chars) uuid should not trigger a search.
- [ ] Reader is not displaying the textfile. `/f/b62716c`
- [ ] Change helper.CookieStore behavour when no value is used, the randomized value must be ASCII compatible, as UTF-8 strings break the noice value.

Expand Down
4 changes: 2 additions & 2 deletions model/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (f *Artifacts) ID(
if exec == nil {
return nil, ErrDB
}
if ids == nil && uuids == nil {
if (ids == nil && uuids == nil) || (len(ids) == 0 && len(uuids) == 0) {
return models.FileSlice{}, nil
}
mods := []qm.QueryMod{}
Expand All @@ -298,7 +298,7 @@ func (f *Artifacts) ID(
mods = append(mods, qm.Or("id = ?", id))
}
for _, uuid := range uuids {
mods = append(mods, qm.Or("uuid = ?", uuid))
mods = append(mods, qm.Or("uuid = ?", uuid.String()))
}
mods = append(mods, qm.Limit(Maximum), qm.WithDeleted())
fs, err := models.Files(mods...).All(ctx, exec)
Expand Down

0 comments on commit e11b7ae

Please sign in to comment.