The problem is solved!(是我的问题还是文档的问题???)@julian
uploaded profile image has bad URL
-
Hello,
I have uploaded an image to my profile on my own build nodebb and the profile picture fails cause it has bad URL.
I am running my nodebb under /community and when I upload the image it gives me the following url: https://vpsie.com/community/community/uploads/profile/2-profileimg.png when I should only have community ones: https://vpsie.com/community/uploads/profile/2-profileimg.png
Do you guys have any suggestions how should I fix this issue?thanks in advance.
-
@Peter-Zoltan-Keresztes Can you provide your config.json (keys and passwords removed) as well as the configuration of your proxy (nginx/apache).
Looks like you've defined /community in both the config.json & the proxy, so it's going to base_url/community. But base_url already contains community.
-
It is only configured in the config:
{ "port": "4568", "secret": "some string", "database": "mongo", "mongo": { "host": "127.0.0.1", "port": "27017", "username": "admin", "password": "", "database": "0" }, "url": "https://vpsie.com/community" }
and nginx proxy for community looks like this:
location ^~ /community { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:4568; proxy_redirect off; }
-
So the file is uploaded to the correct place it's just the url saved that is not correct?
If you know your uid can you post the output of the following?
redis-cli hget user:<youruid> uploadedpicture
-
Yes the file is uploaded to the correct place and its just the url save that is wrong. I am running this on mongodb not redis. I doubt that command will work.
-
On mongodb you can just run
mongo db.objects.find({_key:"user:<youruid>"}).pretty();
Don't forget to remove your password from the output.
-
Here is the entry from the database.
db.objects.find({_key:"user:2"}).pretty(); { "_id" : ObjectId("53d79cfe98fa3bf35ba96e41"), "_key" : "user:2", "banned" : 0, "birthday" : "", "email" : "[email protected]", "email:confirmed" : 1, "fullname" : "", "gravatarpicture" : "https://secure.gravatar.com/avatar/7a192cf8dddf900c964f772b46e81ae7?size=128&default=identicon&rating=pg", "joindate" : 1406639358362, "lastonline" : 1423592859354, "lastposttime" : 1423542804847, "location" : "New York", "password" : "", "picture" : "/community/uploads/profile/2-profileimg.png", "postcount" : 13, "profileviews" : 10, "reputation" : 2, "signature" : "", "status" : "online", "uid" : 2, "uploadedpicture" : "/community/uploads/profile/2-profileimg.png", "username" : "admin", "userslug" : "admin", "website" : "http://https://vpsie.com", "followingCount" : 0, "followerCount" : 1, "topiccount" : 11 }
-
Try with https://github.com/NodeBB/NodeBB/commit/b40b87dd360c28d7df0e6f49274a36cfdda7d0f9
Let us know if it is resolved. Looks like relative_path was already added to the url on the way out.
-
It does not work. It has the same url for the profile image.
-
You will have to reupload the image since it is already stored in the database with the relative_path.
-
That fixed it, however it created another issue. While editing the user change picture is not working now. Until I click the save button on the main profile.
-
I will take a look at it.
-
Try with https://github.com/NodeBB/NodeBB/commit/6a55cdfbaf8b552e60cba21c6eb3a00a6f5fea06 should be resolved.
-
@baris said:
https://github.com/NodeBB/NodeBB/commit/6a55cdfbaf8b552e60cba21c6eb3a00a6f5fea06
All works now. Thank you for your help.
-
Since we have fixed the profile image issue clicking on the admin icon does not do anything. I can see the proper url on the status bar but clicking on it does not have any effect.
-
That's an unrelated bug check here https://github.com/NodeBB/NodeBB/issues/2711