fix(media): usa URL relativa para arquivos em desenvolvimento
Substitui rails_storage_proxy_url (URL absoluta com host ngrok) por rails_storage_proxy_path (URL relativa) em file_url e thumb_url. Problema: ngrok mostra página de interstitial HTML para sub-recursos carregados pelo browser (img/audio) sem cookie ngrok válido. O browser recebia HTML em vez da mídia → imagem 'não disponível' e áudio '00:00/00:00'. Solução: URL relativa (/rails/active_storage/blobs/proxy/...) resolve para o servidor atual sem passar pelo ngrok, eliminando o interstitial. Funciona tanto em localhost:3000 quanto acessando via ngrok no browser. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5d3ce4e565
commit
cfa2dc71bd
@ -53,7 +53,8 @@ class Attachment < ApplicationRecord
|
||||
return '' unless file.attached?
|
||||
|
||||
if Rails.env.development?
|
||||
rails_storage_proxy_url(file, **dev_url_options)
|
||||
# Use relative path so browser loads directly from local server (avoids ngrok interstitial)
|
||||
rails_storage_proxy_path(file)
|
||||
else
|
||||
url_for(file)
|
||||
end
|
||||
@ -74,7 +75,7 @@ class Attachment < ApplicationRecord
|
||||
begin
|
||||
representation = file.representation(resize_to_fill: [250, nil])
|
||||
if Rails.env.development?
|
||||
rails_storage_proxy_url(representation, **dev_url_options)
|
||||
rails_storage_proxy_path(representation)
|
||||
else
|
||||
url_for(representation)
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user