LouiseMcMahon / nodebb-plugin-s3-uploads

A plugin for NodeBB to take file uploads and store them on S3
MIT License
17 stars 23 forks source link

invalid url generated for user images #5

Closed yoann-antoviaque closed 8 years ago

yoann-antoviaque commented 8 years ago

in https://github.com/LewisMcMahon/nodebb-plugin-s3-uploads/blob/master/index.js#L312 we can see that the host is prefixed with // to handle http and https

but nodebb, searches for http to decide if it is a relative url or not, therefore, urls are seen as relative to nodebb installation and prefixed with nodebb's path (https://github.com/NodeBB/NodeBB/blob/master/src/user/data.js#L115)

I think there should be an option to set http or https, or simply specify it in the host, that would fix this issue while still allowing both

LewisMcMahon commented 8 years ago

Can you tell me how to test this? are we talking about user profile pictures?

yoann-antoviaque commented 8 years ago

yes, I was talking about user profile picture.

To test it, just install nodebb with a non empty relative_path, login and go to the user profile, change profile picture, the browser will try to download a picture from the nodebb server with path containing the configured host (or the bucket name if no host is configured).

I'm working on a patch to submit and will attached it once I can confirm the fix

LewisMcMahon commented 8 years ago

I would be ok with just hard coding the https as all s3 buckets are https enabled now they were now when the plugin was originally written.

LewisMcMahon commented 8 years ago

Also if you wish to push a fix thats great but please make sure to read the contribution guidelines

yoann-antoviaque commented 8 years ago

I've submitted a new pull request that should respect the guidelines... sorry

LewisMcMahon commented 8 years ago

thanks