开发者

Rails aws::s3 question: How do I get a url/link to a kml file stored in S3?

开发者 https://www.devze.com 2023-03-17 02:05 出处:网络
I have a rai开发者_StackOverflow社区ls app that creates a kml file and successfully loads it to s3.I can\'t figure out how to get that file back out as a usable link.Nothing fancy. It would be nice to

I have a rai开发者_StackOverflow社区ls app that creates a kml file and successfully loads it to s3. I can't figure out how to get that file back out as a usable link. Nothing fancy. It would be nice to control the appearance of the url, but I'm looking for the simplest solution.

Specifically, when I attempt to do this in the controller with a

render myS3Object.value, :layout => false

I get a "Template missing" error page (which does include the file's text) in my browser, and a "file not found" in Google Earth.

When I use

redirect_to myS3Object.url(:authenticated => false)

I get

<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>blar</RequestId>
<HostId>blar</HostId>
</Error>

in the browser, and another "file not found" in Google Earth.

I also tried url_for, and setting expires for 3 hours in the future, with no luck.

BTW, I have the Mime type specified in my mimes file, and restarted the server.


This worked, for the most part:

send_data myS3Object.value
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号