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

[WIP] Add public_service_url for public assets. #34581

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@gmcgibbon
Copy link
Member

commented Dec 1, 2018

Summary

Fixes #34552.

Adds ActiveStorage::Blob#service_url example to guides.

@georgeclaghorn

This comment has been minimized.

Copy link
Member

commented Dec 1, 2018

public images hosted on Amazon S3

service_url isn’t appropriate for this use case. It returns a different signed URL every time it’s called. We need to implement first-class support for public files.

@gmcgibbon gmcgibbon changed the title Add serive_url example to ActiveStorage guides [WIP] Public serive_url Dec 1, 2018

@gmcgibbon gmcgibbon force-pushed the gmcgibbon:add_service_url_example branch from 9625ab9 to 38cec4d Dec 3, 2018

@rails-bot rails-bot bot added the activestorage label Dec 3, 2018

@gmcgibbon gmcgibbon changed the title [WIP] Public serive_url [WIP] Add public_service_url for public assets. Dec 3, 2018

@@ -116,6 +116,22 @@ def url_for_direct_upload(key, expires_in:, content_type:, content_length:, chec
end
end

def public_url(key, filename:, disposition:, content_type:)

This comment has been minimized.

Copy link
@gmcgibbon

gmcgibbon Dec 3, 2018

Author Member

This still technically generates a signed URL, just not with any expiry. I'll have to read up on the azure gem to see how to do this properly.

@@ -123,6 +123,32 @@ def url_for_direct_upload(key, expires_in:, content_type:, content_length:, chec
end
end

def public_url(key, filename:, content_type:, disposition:)

This comment has been minimized.

Copy link
@gmcgibbon

gmcgibbon Dec 3, 2018

Author Member

This is also still a signed URL without expiry. I assume we may want to attach metadata and/or encode the key to the asset? If not I can probably just make another controller action in ActiveStorage::DiskController that uses the unencoded key as a param.

@@ -95,6 +95,16 @@ def url_for_direct_upload(key, expires_in:, content_type:, content_length:, chec
end
end

def public_url(key, **)

This comment has been minimized.

Copy link
@gmcgibbon

gmcgibbon Dec 3, 2018

Author Member

Both GCS and S3 appear to have not have support for content_type, disposition, and filename options when generating public URLs.

@elia elia referenced this pull request Apr 15, 2019

Open

ActiveStorage support #2974

7 of 7 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.