-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Fix possible panic #17694
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
Fix possible panic #17694
Conversation
- The code will get the first and second character `link[{0,1]]`. However in a rare case the `link` could have 1 character and thus the `link[1]` will create a panic.
I agree about this fix. One more thing, if some fallbackImage is "/", I think we should fix that fallbackImage to a real correct fallback image. |
That seems good to me, what do you suggest that the fallback of the fallback should be? |
I haven't read about the code. I think the "correct fallback images" should depend on the avatar owners. For users, the default avatar is For repositories, IIRC: if no avatar was set, then no avatar should be shown, so I think here we have a deeper problem: we were trying to show an incorrect avatar for a repository without avatar. |
Just to note - that when this happen the admin of the gitea server was doing this on purpose as if it was explicitly set to the fallbackImage mode whereby that setting was set to a value of "/" of some sort. |
OK, then I think something like this would be enough (and more simple):
|
- The code will get the first and second character `link[{0,1]]`. However in a rare case the `link` could have 1 character and thus the `link[1]` will create a panic.
link[{0,1]]
. However in a rare case thelink
could have 1 character and thus thelink[1]
will create a panic.