forgejo/models
Lunny Xiao c40c753613
Check Mirror exists before linking its Repo (#20840) (#20842)
In MirrorRepositoryList.loadAttributes there is some code to load the Mirror entries
from the database. This assumes that every Repository which has IsMirror set has
a Mirror associated in the DB. This association is incorrect in the case of
Mirror repository under creation when there is no Mirror entry in the DB until
completion.

Unfortunately LoadAttributes makes this incorrect assumption and presumes that a
Mirror will always be loaded. This then causes a panic.

This PR simply double checks if there a Mirror before attempting to link back to
its Repo. Unfortunately it should be expected that there may be other cases where
this incorrect assumption causes further problems.

Fix #20804

Signed-off-by: Andrew Thornton <art27@cantab.net>

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
2022-08-18 11:57:40 +03:00
..
admin
appstate
asymkey Move some repository related code into sub package (#19711) 2022-06-06 16:01:49 +08:00
auth WebAuthn CredentialID field needs to be increased in size (#20530) (#20555) 2022-07-30 20:16:25 +02:00
avatars
db Add migrate repo archiver and packages storage support on command line (#20757) (#20806) 2022-08-18 09:27:56 +08:00
fixtures Exclude Archived repos from Dashboard Milestones (#19882) 2022-06-04 19:30:01 +01:00
foreignreference
git Add migrate repo archiver and packages storage support on command line (#20757) (#20806) 2022-08-18 09:27:56 +08:00
issues Display project in issue list (#20583) 2022-08-02 17:14:31 +03:00
migrations Fix v220 migration to be compatible for MSSQL 2008 r2 (#20702) (#20707) 2022-08-08 17:58:11 +02:00
organization Move tests as seperate sub packages to reduce duplicated file names (#19951) 2022-06-15 09:02:00 +02:00
packages Add Docker /v2/_catalog endpoint (#20469) (#20556) 2022-07-30 17:52:04 +02:00
perm Store read access in access for team repo's (#20275) (#20276) 2022-07-09 20:01:44 +02:00
project Use correct count for NumOpenIssues (#19980) 2022-06-16 10:51:34 +08:00
pull
repo Check Mirror exists before linking its Repo (#20840) (#20842) 2022-08-18 11:57:40 +03:00
unit
unittest Use git.HOME_PATH for Git HOME directory (#20114) (#20293) 2022-07-08 21:44:36 +08:00
user Add migrate repo archiver and packages storage support on command line (#20757) (#20806) 2022-08-18 09:27:56 +08:00
webhook Check webhooks slice length before calling xorm (#20642) (#20768) 2022-08-12 11:36:45 +03:00
action.go Refix indices on actions table (#20158) (#20198) 2022-07-02 15:31:51 +02:00
action_list.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2022-05-20 22:08:52 +08:00
action_test.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
consistency.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
error.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
fixture_generation.go
fixture_test.go
main_test.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
migrate.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
migrate_test.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
notification.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
notification_test.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
org.go In code search, get code unit accessible repos in one (main) query (#19764) 2022-06-16 02:24:10 +03:00
org_team.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
org_team_test.go
org_test.go Move tests as seperate sub packages to reduce duplicated file names (#19951) 2022-06-15 09:02:00 +02:00
release.go improvement some release related code (#19867) 2022-06-03 02:13:58 -04:00
repo.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
repo_activity.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
repo_collaboration.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
repo_collaboration_test.go Move tests as seperate sub packages to reduce duplicated file names (#19951) 2022-06-15 09:02:00 +02:00
repo_test.go Move tests as seperate sub packages to reduce duplicated file names (#19951) 2022-06-15 09:02:00 +02:00
repo_transfer.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
repo_transfer_test.go
statistic.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
task.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2022-05-20 22:08:52 +08:00
token.go
token_test.go
upload.go
user.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
user_heatmap.go
user_heatmap_test.go