Open-event-server: Wrong image link gets stored instead of becoming null when image is deleted

Created on 4 Aug 2019  Â·  37Comments  Â·  Source: fossasia/open-event-server

Describe the bug
On deleting profile image, the same image link gets stored in avatarUrl with localhost instead of open-event-api-dev.herokuapp.com.

Expected behavior
Image link should become null.

bug codeheat

All 37 comments

Will take a look

@shreyanshdwivedi If you haven't spent much time on it, May I take this up?

@prateekj117 yeah sure. I'm a bit busy with other issues

@shreyanshdwivedi @ShridharGoel I tried it in development (herokuapp) instance, making PATCH request to change avatar-url from non-null to null works fine, and returns null.

@iamareebjamal

@ShridharGoel this will be fixed here https://github.com/fossasia/open-event-frontend/pull/3361

But that is happening on mobile, so it is server issue. Fixing something in frontend won't fix it in mobile

the same image link gets stored in avatarUrl with localhost instead of open-event-api-dev.herokuapp.com.

@ShridharGoel I don't follow? What's the correlation between image link and localhost and heroku?

Image link is - open-event-api-dev.herokuapp.com/static/haha.jpeg

Becomes localhost/static/haha.jpeg on deleting it

@shreyanshdwivedi @ShridharGoel I tried it in development (herokuapp) instance, making PATCH request to change avatar-url from non-null to null works fine, and returns null.

@iamareebjamal

@ShridharGoel Can you please test again

Tested again. The issue is still there.

@ShridharGoel If possible, can you please share the exact request being sent to the server.

@iamareebjamal @ShridharGoel @prateekj117 I can't reproduce it through postman, does it happen only via android? It's strange because, deleting an image is equivalent to changing, the avatar URL from some value to null; the keyword localhost can't magically appear.

@ShridharGoel How exactly are you testing it? If it's not reproducible via postman, then it's not a server issue.

@CosmicCoder96 After deleting an image, I am setting the avatar-url to null and updating the user. But then on fetching the user details again, the link with localhost is being fetched.

Try with Postman. If it is not happening with Postman, something is wrong on Android side

Postman screenshot

@iamareebjamal I am not experiencing it using Postman.

Try with same payload @prateekj117

@ShridharGoel Does the same happen in production?

@iamareebjamal Tried. Still not happening locally. Though I found something weird. When I am sending this request:

Screenshot from 2019-08-17 13-26-50

Only avatar_url gets updated, and the data in before_update_object function only has avatar_url in it. Can you please check if something is wrong in the request I am sending, or is it a bug.

Does the same happen in production?

In production, the image is not getting deleted. Same link is being returned. Tried deleting the image via frontend too, but it did not get deleted.

In production, the image is not getting deleted. Same link is being returned. Tried deleting the image via frontend too, but it did not get deleted.

@iamareebjamal Should I create a separate issue for this?

In production, the image is not getting deleted. Same link is being returned. Tried deleting the image via frontend too, but it did not get deleted.

@ShridharGoel Try again after updating frontend dev branch, it was solved in https://github.com/fossasia/open-event-frontend/pull/3361.

Try again after updating frontend dev branch, it was solved in fossasia/open-event-frontend#3361.

But it's a server issue because it's there on Android too and can be reproduced via Postman also.

@ShridharGoel Yes. That is the case. But the localhost url is wrong anyway, so it should not have displayed the avatar after deletion. So it was happening on frontend due to some different issue I guess.

@prateekj117 It is displaying the same avatar after deletion only on the production instance. For the dev instance the link is getting changed to the localhost one.

@prateekj117 Frontend comes nowhere in this issue

@iamareebjamal Yes, that's a different issue.

All images except avatar-url and maybe thumbnail-url are/should be dump only. So, they should not be sent to server,

Nevertheless, sending them should not break the implementation

@CosmicCoder96 Try uploading the image on https://open-event-fe.netlify.com

All links are localhost

Deleting is not working as well. On production as well

I reproduced it the first time I tried. I don't know what you guys were doing. @prateekj117

@iamareebjamal I was trying on localhost.

@iamareebjamal In case you were able to reproduce it on localhost, can you please share your exact request.

Issue is on hosted instances

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SaptakS picture SaptakS  Â·  3Comments

iamareebjamal picture iamareebjamal  Â·  4Comments

mariobehling picture mariobehling  Â·  4Comments

mariobehling picture mariobehling  Â·  4Comments

SaptakS picture SaptakS  Â·  3Comments