milesrichardson / ParsePy

A relatively up-to-date fork of ParsePy, the Python wrapper for the Parse.com API. Originally maintained by @dgrtwo
MIT License
516 stars 184 forks source link

Incorrect URLs for AWS hosted files #156

Closed francisjervis closed 7 years ago

francisjervis commented 7 years ago

After migrating to parse-server using the S3 file storage adapter, 's3.amazonaws.com' is being appended to the start of the URL, causing loads to fail. For example: https://s3.amazonaws.com//db.timesfree.co/parse/files/timesfree/tfss-c0c5f1be-add4-4429-bacb-7e41039f7976-profileImage.jpg should be https://db.timesfree.co/parse/files/timesfree/tfss-c0c5f1be-add4-4429-bacb-7e41039f7976-profileImage.jpg

This looks like it is happening either here https://github.com/milesrichardson/ParsePy/blob/master/parse_rest/datatypes.py#L308 or at 299.

Will submit a PR soon, hopefully.

milesrichardson commented 7 years ago

I haven't actually used this library in prod in a long time, and back when I was using it, there was no file support. IIRC file support was introduced in a PR so I wouldn't be surprised if there are some issues.

Seems like a simple fix. Since hosted Parse is basically deprecated at this point (2 weeks?) I'm happy to accept a PR that totally removes the s3.amazonaws.com appending (as opposed to checking if it's self hosted or Parse.com)

One thing to make sure of is that the feature is agnostic to file backend (whether you are using s3 adapter or the google cloud adapter). I'm not sure how parse-server implements this.... it might already be agnostic at their level

francisjervis commented 7 years ago

Sorry - was on my end. Hack I'd introduced to work around an issue with the hosted API :)