Skip to content

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

@btrepp

Description

@btrepp
  • Gitea version (or commit ref): d2bb8ef
  • 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{})

...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions