gitea/services
Giteabot 6203ae764a
Distinguish LFS object errors to ignore missing objects during migration (#31702) (#31745)
Backport #31702 by @wolfogre

Fix #31137.

Replace #31623 #31697.

When migrating LFS objects, if there's any object that failed (like some
objects are losted, which is not really critical), Gitea will stop
migrating LFS immediately but treat the migration as successful.

This PR checks the error according to the [LFS api
doc](https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md#successful-responses).

> LFS object error codes should match HTTP status codes where possible:
> 
> - 404 - The object does not exist on the server.
> - 409 - The specified hash algorithm disagrees with the server's
acceptable options.
> - 410 - The object was removed by the owner.
> - 422 - Validation error.

If the error is `404`, it's safe to ignore it and continue migration.
Otherwise, stop the migration and mark it as failed to ensure data
integrity of LFS objects.

And maybe we should also ignore others errors (maybe `410`? I'm not sure
what's the difference between "does not exist" and "removed by the
owner".), we can add it later when some users report that they have
failed to migrate LFS because of an error which should be ignored.

Co-authored-by: Jason Song <i@wolfogre.com>
2024-07-31 23:06:37 +08:00
..
actions feat(api): enhance Actions Secrets Management API for repository (#30656) 2024-04-26 21:11:49 +08:00
agit Performance optimization for git push (#30104) 2024-04-09 03:43:17 +00:00
asymkey Fix some pending problems (#29985) 2024-03-22 19:17:30 +08:00
attachment Add support for API blob upload of release attachments (#29507) 2024-03-02 17:02:01 +00:00
auth Enable more `revive` linter rules (#30608) 2024-04-22 11:48:42 +00:00
automerge Fix automerge will not work because of some events haven't been triggered (#30780) (#31039) 2024-05-22 02:08:05 +00:00
context Check if reverse proxy is correctly configured (#30890) (#30935) 2024-05-10 12:34:04 +00:00
contexttest Check if reverse proxy is correctly configured (#30890) (#30935) 2024-05-10 12:34:04 +00:00
convert Fix API repository object format missed (#31118) (#31132) 2024-05-28 09:59:56 +00:00
cron Move some asymkey functions to service layer (#28894) 2024-03-04 08:57:39 +00:00
doctor Add a db consistency check to remove runners that do not belong to a repository (#30614) 2024-04-23 03:51:52 +00:00
externalaccount [Fix] Account Linking UpdateMigrationsByType (#31428) (#31434) 2024-06-20 13:53:15 +00:00
feed More `db.DefaultContext` refactor (#27265) 2023-09-29 12:12:54 +00:00
forms Fix: Allow org team names of length 255 in create team form (#31564) (#31603) 2024-07-10 12:28:27 -04:00
gitdiff Refactor sha1 and time-limited code (#31023) (#31030) 2024-05-21 00:58:21 +08:00
indexer Update issue indexer after merging a PR (#30715) (#30903) 2024-05-09 13:51:57 +08:00
issue Fix various problems around projects board view (#30696) (#30902) 2024-05-08 15:46:21 +00:00
lfs Fix #31185 try fix lfs download from bitbucket failed (#31201) (#31329) 2024-06-12 02:34:37 +03:00
mailer Fix incorrect message id for release email (#30825) (#30833) 2024-05-03 00:00:29 +08:00
markup Enable more `revive` linter rules (#30608) 2024-04-22 11:48:42 +00:00
migrations Fix "force private" logic (#31012) (#31021) 2024-05-20 10:27:52 +08:00
mirror Remove unused parameter for some functions in `services/mirror` (#30724) 2024-04-27 10:44:49 +00:00
notify Clean up log messages (#30313) 2024-04-07 19:17:06 +08:00
org Update misspell to 0.5.1 and add `misspellings.csv` (#30573) 2024-04-27 08:03:49 +00:00
packages remove util.OptionalBool and related functions (#29513) 2024-03-02 16:42:31 +01:00
pull Add permission check when creating PR (#31033) (#31720) 2024-07-29 14:11:29 +08:00
release Check if the release is converted from the tag when updating the release (#30984) (#30986) 2024-05-15 16:34:38 -05:00
repository Distinguish LFS object errors to ignore missing objects during migration (#31702) (#31745) 2024-07-31 23:06:37 +08:00
secrets Refactor deletion (#28610) 2023-12-25 21:25:29 +01:00
task Fix "force private" logic (#31012) (#31021) 2024-05-20 10:27:52 +08:00
uinotification Penultimate round of `db.DefaultContext` refactor (#27414) 2023-10-11 04:24:07 +00:00
user Fix bug on avatar (#31008) (#31019) 2024-05-20 02:54:53 +00:00
webhook Use old behavior for telegram webhook (#31588) 2024-07-09 11:23:33 +08:00
webtheme Initial support for colorblindness-friendly themes (#30625) 2024-04-24 00:18:41 +08:00
wiki Avoid showing `Failed to change the default wiki branch` if repo has no wiki when saving repo settings (#30329) 2024-04-08 19:43:23 +08:00