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

[Bug] Function is_default_profile_pic does not work as expected. #486

Open
Shion1305 opened this issue Jan 21, 2024 · 0 comments
Open

[Bug] Function is_default_profile_pic does not work as expected. #486

Shion1305 opened this issue Jan 21, 2024 · 0 comments

Comments

@Shion1305
Copy link

Describe the bug / How To Reproduce
My email is [email protected] .
Looks like google returns the following 2 images for my account.

GHunt uses is_default_profile_pic to figure out whether the profile image is the default one or not.

async def is_default_profile_pic(as_client: httpx.AsyncClient, image_url: str) -> Tuple[bool, str]:
"""
Returns a boolean which indicates if the image_url
is a default profile picture, and the flathash of
the image.
"""
flathash = await get_url_image_flathash(as_client, image_url)
if imagehash.hex_to_flathash(flathash, 8) - imagehash.hex_to_flathash("000018183c3c0000", 8) < 10 :
return True, str(flathash)
return False, str(flathash)

However if I pass the url for my default profile picture, it returns True.
So looks like this does not work as expected.

I found that if the profile image is default, it has isDefault field, and otherwise it does not or it is false.
I suggest that it should be judged by the isDefault field, like the logic for cover photos.

elif photo_type == "cover_photo":
self.url = '='.join(photo_data.get("imageUrl").split("=")[:-1])
if (isDefault := photo_data.get("isDefault")):
self.isDefault = isDefault

Also the flag is not used by any other functions, so I think it can be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant