Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete Avatar Problem #8176

Closed
jaqra opened this issue Sep 13, 2019 · 4 comments · Fixed by #8547
Closed

Delete Avatar Problem #8176

jaqra opened this issue Sep 13, 2019 · 4 comments · Fixed by #8547
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Milestone

Comments

@jaqra
Copy link
Contributor

jaqra commented Sep 13, 2019

There is a problem something like this, reproduce:

  1. Create 2 organizations
  2. Set their avatars as same image
  3. Delete one organization

Then you will see other organization's avatar reset to default gitea avatar, becouse image removed from disk.

This is same:

  • Organization avatar
  • User avatar
  • Repository avatar

My opinions for solution:

  1. Check if there are other same avatar name before remote from disk
  2. Check if there are other same avatar name before set avatar and give new name if there
@guillep2k
Copy link
Member

The filename is a hash of the avatar contents. For this, I think we should add the owner as part of the hash and force the names to be different. Otherwise, we'll have to keep a reference count for every file.

@jaqra
Copy link
Contributor Author

jaqra commented Sep 13, 2019

IMHO First one does not affect? If a user add same image to multiple organization then remove one

@guillep2k
Copy link
Member

If your NASA organization adds planet.png as avatar, the file is uploaded as:

data/attachments/e/4/e4dc1049-68cd-4ed0-9636-41c0a04b0a69

The name is calculated by hashing its content. If ESA adds the same picture of a planet (no matter the file name, only the byte-by-byte content of the file), then it will be named again:

data/attachments/e/4/e4dc1049-68cd-4ed0-9636-41c0a04b0a69

That's why if ESA deletes its file, NASA's file gets deleted too. However, if we apply other metadata to the hash input, the hash will be different each case, for example:

NASA's planet.png       fe5156a4-6562-49a6-8732-1dbb48639560
ESA's planet.png        b519f855-1e11-4893-b64e-95ca221758cd

Even if they are the same file.

That should solve the problem, because if ESA deletes or changes its avatar, only b519f855-1e11-4893-b64e-95ca221758cd will be deleted, while fe5156a4-6562-49a6-8732-1dbb48639560 will remain untouched.

@stale
Copy link

stale bot commented Nov 13, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Nov 13, 2019
@lunny lunny added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Nov 13, 2019
@stale stale bot removed the issue/stale label Nov 13, 2019
@ghost ghost mentioned this issue Nov 13, 2019
7 tasks
@lunny lunny added this to the 1.11.0 milestone Dec 28, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants