minad / olelo

Wiki with git backend
MIT License
241 stars 44 forks source link

Inline external images do not get displayed #5

Closed cout closed 14 years ago

cout commented 14 years ago

The spec seems a bit vague, but from reading the examples at:

http://www.wikicreole.org/wiki/Images http://www.wikicreole.org/wiki/Links

it seems to me that text like:

{{http://www.google.com/intl/en_ALL/images/logo.gif|Google Logo}}

should get displayed inline.

cout commented 14 years ago

Hmm, I don't see a way to post an attachment, so here's the diff:

diff --git a/plugins/filter/creole.rb b/plugins/filter/creole.rb
index 73f4d08..30a3542 100644
--- a/plugins/filter/creole.rb
+++ b/plugins/filter/creole.rb
@@ -26,8 +26,13 @@ Filter.create :creole do |content|
           args.delete(geometry)
           opts[:geometry] = geometry
         end
-        image_path = resource_path(@page, opts)
-        page_path = resource_path(@page, :path => path)
+        if path =~ %r{^(http|ftp)://} then
+          image_path = path.dup
+          page_path = path.dup
+        else
+          image_path = resource_path(@page, opts)
+          page_path = resource_path(@page, :path => path)
+        end
       end
       image_path = Wiki.html_escape(image_path)
       page_path = Wiki.html_escape(page_path)
cout commented 14 years ago

On a side note:

http://www.wikicreole.org/wiki/Talk.Images

mentions the security risks involved with inline external images. Should this feature be configurable?

minad commented 14 years ago

I think there are no objections if it is configurable.

It would be nice if you fork the wiki because pulling your changes would be easier for me.

minad commented 14 years ago

fixed. configuration parameter external_img added