You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm still wrapping my head around the gem and ActiveStorage.
When using the gem - the uploaded files were persisted in the databases - however I wasn't able to serve them using either url_for or image_tag.
It looks like that the ActiveSupport::MessageVerifier does not work well with ruby hashes. If the message that needs to be generated is a hash with symbolized keys, the verify method returns the message with stringified keys (rather than a hash with indifferent access)
The above is used when serving the file from the URL. Example:
Started GET "/rails/active_storage/postgresql/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiIxbmQzbHoyanptNDE3dmtpMjh4dWl4bTBpdWM4IiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwiaXdwLmpwZ1wiOyBmaWxlbmFtZSo9VVRGLTgnJ2l3cC5qcGciLCJjb250ZW50X3R5cGUiOiJpbWFnZS9wbmcifSwiZXhwIjoiMjAyNC0wNi0wNFQwMDo0NToyMS45ODFaIiwicHVyIjoiYmxvYl9rZXkifX0=--29d1f4d86f0c7b323e8dac08629e1c624cb88ea4/iwp.jpg?content_type=image%2Fpng&disposition=inline%3B+filename%3D%22iwp.jpg%22%3B+filename%2A%3DUTF-8%27%27iwp.jpg"for 127.0.0.1 at 2024-06-03 18:42:24 -0600
Processing by ActiveStorage::PostgresqlController#show as JPEG
Parameters: {"content_type"=>"image/png", "disposition"=>"inline; filename=\"iwp.jpg\"; filename*=UTF-8''iwp.jpg", "encoded_key"=>"[FILTERED]", "filename"=>"iwp"}
All example I've found online for generating a message assumed a string message. So, I'm not entirely sure if the message can be a key.
However for this to work the following line might need to be changed to symbolize the verified keys
I'm still wrapping my head around the gem and ActiveStorage.
When using the gem - the uploaded files were persisted in the databases - however I wasn't able to serve them using either
url_for
orimage_tag
.It looks like that the ActiveSupport::MessageVerifier does not work well with ruby hashes. If the message that needs to be generated is a hash with symbolized keys, the
verify
method returns the message with stringified keys (rather than a hash with indifferent access)Steps to repeat:
The above is used when serving the file from the URL. Example:
All example I've found online for generating a message assumed a string message. So, I'm not entirely sure if the message can be a key.
However for this to work the following line might need to be changed to symbolize the verified keys
active_storage-postgresql/app/controllers/active_storage/postgresql_controller.rb
Line 64 in fa5bc8f
Edit
versions:
The text was updated successfully, but these errors were encountered: