Description
func DropTableColumns(...) (err error) {
switch {
....
case setting.Database.Type.IsMSSQL():
....
for _, constraint := range constraints {
if _, err := sess.Exec(fmt.Sprintf("DROP INDEX `%[2]s` ON `%[1]s`",
tableName, constraint)); err != nil {
return fmt.Errorf("Drop index `%[2]s` on `%[1]s`: %v", // <=
tableName, constraint, err)
}
}
....
}
....
}
In this case, %[1]s points to the first argument, tableName, and implicitly shifts the argument number for the next placeholder by 1 from the current one—so the second argument, constraint, is used instead of the intended err.
A strange piece of code was found inside the db.go file on line 462.
Gitea Version
...
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
...
Database
None