gitea doctor will remove repo-avatar files #12718

Closed
opened 2025-11-02 10:18:59 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @eeyrjmr on GitHub (Mar 24, 2024).

Description

if a user configures a repo to have a custom avatar then gitea doctor check --fix --all deletes the associated avatar files.

STARTING CASE:
2024-03-24_00-03-1711240637
jupyterlab icon added to a repo

2024-03-24_00-03-1711240546
blob is found on the filesystem.

gitea doctor check --fix --all is executed and completes.

2024-03-24_00-03-1711240764
the repo-avatar directory is now empty.

viewing with a browser confirms the avatar is missing.
2024-03-24_00-03-1711240894
LEFT is chrome using cached image, RIGHT is incognito mode.

The behaviour of services/doctor/storage.go implies that orphaned files will be deleted
e3e08dcc51/services/doctor/storage.go (L92C1-L93C1)

how to indicate that repo-avatars are not orphan files.

sidenote... what else could be classed as orphaned and incorrectly removed

Gitea Version

1.21.9

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

windows and linux

Database

MySQL/MariaDB

Originally created by @eeyrjmr on GitHub (Mar 24, 2024). ### Description if a user configures a repo to have a custom avatar then **gitea doctor check --fix --all** deletes the associated avatar files. STARTING CASE: ![2024-03-24_00-03-1711240637](https://github.com/go-gitea/gitea/assets/4564448/53a95c2c-d9bb-4e4f-ad37-deaee6fcde53) jupyterlab icon added to a repo ![2024-03-24_00-03-1711240546](https://github.com/go-gitea/gitea/assets/4564448/b260978c-e4d7-4ba1-b7a4-514876ea63d5) blob is found on the filesystem. **gitea doctor check --fix --all** is executed and completes. ![2024-03-24_00-03-1711240764](https://github.com/go-gitea/gitea/assets/4564448/87026b67-2d58-43c6-97b3-d2e2f9702d60) the repo-avatar directory is now empty. viewing with a browser confirms the avatar is missing. ![2024-03-24_00-03-1711240894](https://github.com/go-gitea/gitea/assets/4564448/0cfcbedd-4021-4dcf-9522-75450239d24c) LEFT is chrome using cached image, RIGHT is incognito mode. The behaviour of services/doctor/storage.go implies that orphaned files will be deleted https://github.com/go-gitea/gitea/blob/e3e08dcc5184cdbdac5023fabaafba123a995c3e/services/doctor/storage.go#L92C1-L93C1 how to indicate that repo-avatars are not orphan files. sidenote... what else could be classed as orphaned and incorrectly removed ### Gitea Version 1.21.9 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? windows and linux ### Database MySQL/MariaDB
GiteaMirror added the issue/confirmedtype/bug labels 2025-11-02 10:18:59 -06:00
Author
Owner

@yp05327 commented on GitHub (Mar 26, 2024):

Doctor handles the object id as storage path, but repo archiver needs relative path:
image
image
Then it will be detected as invalid storage path and will be deleted.
image
image

@yp05327 commented on GitHub (Mar 26, 2024): Doctor handles the object id as storage path, but repo archiver needs relative path: ![image](https://github.com/go-gitea/gitea/assets/18380374/68e25d0a-0ee4-4f4b-af6d-87919f9613f9) ![image](https://github.com/go-gitea/gitea/assets/18380374/483fb93d-84e4-4c6e-a05a-21e680bcc1ea) Then it will be detected as invalid storage path and will be deleted. ![image](https://github.com/go-gitea/gitea/assets/18380374/44fdb1ef-47d2-4fa0-a430-d61aee6830a6) ![image](https://github.com/go-gitea/gitea/assets/18380374/d15e421c-22e1-44f6-bff1-e8a599a86700)
Author
Owner

@lunny commented on GitHub (Mar 26, 2024):

Doctor handles the object id as storage path, but repo archiver needs relative path: image image Then it will be detected as invalid storage path and will be deleted. image image

Can you send a PR to fix it?

@lunny commented on GitHub (Mar 26, 2024): > Doctor handles the object id as storage path, but repo archiver needs relative path: ![image](https://private-user-images.githubusercontent.com/18380374/316699199-68e25d0a-0ee4-4f4b-af6d-87919f9613f9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTE0Mjc0NDUsIm5iZiI6MTcxMTQyNzE0NSwicGF0aCI6Ii8xODM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otU2lnbmF0dXJlPWYzZWE2MmM5MjQ0Nzc2YjM2MjZiY2ViMGIzMzJiOTMyMDM3OTNjYTMyNzI1MzQxOGY5MjYyNmZhYTVhNzY5YzMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.d6pADyPBStQ88vnVO8c6KbkZRKlhvduVo4f7WRnoXqY) Then it will be detected as invalid storage path and will be deleted. ![image](https://private-user-images.githubusercontent.com/18380374/316698812-44fdb1ef-47d2-4fa0-a430-d61aee6830a6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTE0Mjc0NDUsIm5iZiI6MTcxMTQyNzE0NSwicGF0aCI6Ii8xODM4MDM3NC8zMTY2OTg4MTItNDRmZGIxZWYtNDdkMi00ZmEwLWE0MzAtZDYxYWVlNjgzMGE2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAzMjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMzI2VDA0MjU0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ1MTc0ZTcyMmY3YjM5MTc4MGExYjc3NWRkNTQ3NDZkZTk5ZTcxNGJmMzc5YWQ2ZWM1YmM3NjVkNTdjODg3OTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.CBOa5NL0vvT9VbfOdWpEGQyfAjyDQDcijZ7vVIRpFik) ![image](https://private-user-images.githubusercontent.com/18380374/316699010-d15e421c-22e1-44f6-bff1-e8a599a86700.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTE0Mjc0NDUsIm5iZiI6MTcxMTQyNzE0NSwicGF0aCI6Ii8xODM4MDM3NC8zMTY2OTkwMTAtZDE1ZTQyMWMtMjJlMS00NGY2LWJmZjEtZThhNTk5YTg2NzAwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAzMjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMzI2VDA0MjU0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThkMmQxM2M0ZDlhZmFkNjI1NzIyYzdmYmMwNmU5ZDg4NGFiNWEyYTQ3ZTQxOGRmYzJlZWM1NjFjMDlhYzg5MTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.JAjhpQHddqe5v8JB10hYlzmXX6tTlu7UfEK9aePK_2o) Can you send a PR to fix it?
Author
Owner

@yp05327 commented on GitHub (Mar 26, 2024):

yeah, but it seems that the root reason is typo 😂
image

@yp05327 commented on GitHub (Mar 26, 2024): yeah, but it seems that the root reason is typo 😂 ![image](https://github.com/go-gitea/gitea/assets/18380374/6a6ec9b1-b680-409a-861c-8210f30b2e67)
Author
Owner

@yp05327 commented on GitHub (Mar 26, 2024):

By my test, if you reupload the same file, it will have no changes.
You need to reupload another one first, then reupload the original file.

@yp05327 commented on GitHub (Mar 26, 2024): By my test, if you reupload the same file, it will have no changes. You need to reupload another one first, then reupload the original file.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12718