Every public key after the first added is a 'duplicate' for MSSQL #250

Closed
opened 2025-11-02 03:15:56 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @btrepp on GitHub (Jan 19, 2017).

  • Gitea version (or commit ref): d2bb8ef503
  • Git version: 2.9.1
  • Operating system: Windows 10
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist: n/a

Description

Using mssql results in every key after the first key being detected as already existing.
It appears the check for "does this key exists" is actually running "does any key exist"

models/ssh_key.go line 360 is the line.

This is most likely caused by go-xorm. It appears as if it is ignoring the text condition for mssql.
A workaround is
has, err := x.Where("content=?",content).Where("type=?",KeyTypeUser).Get(&PublicKey{})

...

Originally created by @btrepp on GitHub (Jan 19, 2017). - Gitea version (or commit ref): d2bb8ef5039 - Git version: 2.9.1 - Operating system: Windows 10 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [x] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: n/a ## Description Using mssql results in every key after the first key being detected as already existing. It appears the check for "does this key exists" is actually running "does any key exist" `models/ssh_key.go line 360` is the line. This is most likely caused by go-xorm. It appears as if it is ignoring the text condition for mssql. A workaround is ```has, err := x.Where("content=?",content).Where("type=?",KeyTypeUser).Get(&PublicKey{})``` ...
GiteaMirror added the type/bug label 2025-11-02 03:15:56 -06:00
Author
Owner

@lunny commented on GitHub (Jan 24, 2017):

There should be a checksum column for compression and as a query condition but not directly content.

@lunny commented on GitHub (Jan 24, 2017): There should be a checksum column for compression and as a query condition but not directly content.
Author
Owner

@lunny commented on GitHub (Feb 14, 2017):

@btrepp please confirm #911 has fixed this issue.

@lunny commented on GitHub (Feb 14, 2017): @btrepp please confirm #911 has fixed this issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#250