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

Change of Content-Type in S3Adapter #628

Closed
mchun opened this issue Feb 24, 2016 · 16 comments
Closed

Change of Content-Type in S3Adapter #628

mchun opened this issue Feb 24, 2016 · 16 comments
Assignees
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@mchun
Copy link

mchun commented Feb 24, 2016

Is there any way to change the content-type when using S3Adapter? Images are all being downloaded instead of being viewed.

@flovilmart
Copy link
Contributor

can you dump the response headers please?

@nlutsenko
Copy link
Contributor

We actually use mime-type magic to reply with a nice and proper content-type, based on the path extension of the filename.
In addition to response headers - can you list a filename that you are downloading?

@mchun
Copy link
Author

mchun commented Feb 25, 2016

@flovilmart Is this what you want?

Access-Control-Allow-Headers:X-Parse-REST-API-Key, X-Parse-Javascript-Key, X-Parse-Application-Id, X-Parse-Client-Version, X-Parse-Session-Token, X-Requested-With, X-Parse-Revocable-Session, Content-Type
Access-Control-Allow-Methods:GET,PUT,POST,DELETE,OPTIONS
Access-Control-Allow-Origin:*
Connection:keep-alive
Content-Length:139
Content-Type:application/json
Date:Thu, 25 Feb 2016 03:34:02 GMT
Location:https://freesthdebugclone.s3.amazonaws.com/8ef9d2eac26f3d59f62142090728ca54_1.jpg
X-Powered-By:Express

@mchun
Copy link
Author

mchun commented Feb 25, 2016

The above file's filename is ustrobot.jpg and I uploaded it via the Parse Javascript SDK as the following:
Parse.File(current+".jpg", { base64 : data }, "image/jpeg");

@nlutsenko nlutsenko added type:bug Impaired feature or lacking behavior that is likely assumed and removed troubleshooting labels Feb 25, 2016
@nlutsenko
Copy link
Contributor

Yup, looks like we are overriding the content-type for some reason on replies on files. Sounds like a bug.

@nlutsenko nlutsenko self-assigned this Feb 25, 2016
@nlutsenko
Copy link
Contributor

Will dive deep early tomorrow...

@flovilmart
Copy link
Contributor

@nlutsenko I'm on it!

@flovilmart
Copy link
Contributor

@mchun should be fixed, try the master or wait for the next release!

@mchun
Copy link
Author

mchun commented Mar 3, 2016

Yes, working properly now. You are awesome @flovilmart, thanks a lot!

@flovilmart
Copy link
Contributor

🎉

@mchun
Copy link
Author

mchun commented Mar 3, 2016

um.....i found something...
the photo url is
http://localhost:1337/parse/files/myAppId/6460437e918fe2719c5dbbd74474bd6c_1.jpg
instead of
https://bucketname.s3.amazonaws.com/a733ce27cb257422ee70b6414e5afdd4_thumb.jpg
did I get up the latest parse-server wrongly?

@flovilmart
Copy link
Contributor

Did you set the directAccess option?

@mchun
Copy link
Author

mchun commented Mar 3, 2016

Yes. I did not change my code when installing the latest master.
Just rename the existing parse-server folder inside node_modules
git clone parse-server
inside parse-server run npm install
then npm start.
Are these the correct steps?

@mchun
Copy link
Author

mchun commented Mar 3, 2016

And its strange that I can view the photo via the path http://localhost:1337/parse/files/myAppId/6460437e918fe2719c5dbbd74474bd6c_1.jpg
but I cannot find where the file is located in my computer...

@flovilmart
Copy link
Contributor

these are not the correct steps:

you should update package.json with

parse-server: "parseplatform/parse-server"

then run npm install.
If you files is hosted on S3, it's gonna be in you S3 bucket, if it's with the gridstore adapter, it's in the mongo database

@mchun
Copy link
Author

mchun commented Mar 4, 2016

Cant install the master from github, but installed 2.1.4 anyway
Still the same result, new photos are being uploaded to gridstore instead of s3
And the paths of existing s3 uploaded photos are with prefix http://localhost:1337/parse/files/myAppId/, thus cant be showed correctly.

I followed the parse wiki on how to configure the s3 adapter, everythings work in 2.1.3 but not 2.1.4... :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

3 participants