From 48b50f8829052e384c1c78ba70051fb70c72d716 Mon Sep 17 00:00:00 2001 From: Arthur Del Esposte Date: Fri, 2 Oct 2015 20:45:09 +0000 Subject: [PATCH] Consider subdirectory in some images path --- app/models/article.rb | 2 +- app/views/cms/media_panel/_image.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/article.rb b/app/models/article.rb index 55f7abe..5130196 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -809,7 +809,7 @@ class Article < ActiveRecord::Base end def first_image - img = ( image.present? && { 'src' => image.public_filename } ) || + img = ( image.present? && { 'src' => File.join([Noosfero.root, image.public_filename].join) } ) || Nokogiri::HTML.fragment(self.lead.to_s).css('img[src]').first || Nokogiri::HTML.fragment(self.body.to_s).search('img').first img.nil? ? '' : img['src'] diff --git a/app/views/cms/media_panel/_image.html.erb b/app/views/cms/media_panel/_image.html.erb index 1125742..48f243c 100644 --- a/app/views/cms/media_panel/_image.html.erb +++ b/app/views/cms/media_panel/_image.html.erb @@ -1,6 +1,6 @@
- + <%= image_tag(@file.public_filename(:uploaded)) %>
<%= _('Add to the text') %> -- libgit2 0.21.2