From 35257b5fae12757883d7de01db846d38ab959aa2 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Fri, 14 Mar 2008 17:25:02 -0500 Subject: [PATCH] IPv6-compatible fix for latest Philip Taylor Phun This is better than Revision 228. --- app/controllers/wiki_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index d466e9d4..6d69b554 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -3,6 +3,7 @@ require 'maruku' require 'parsedate' require 'zip/zip' require 'sanitize' +require 'resolv' class WikiController < ApplicationController @@ -412,7 +413,7 @@ class WikiController < ApplicationController def remote_ip ip = request.remote_ip logger.info(ip) - ip.gsub!(/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/, '\1') + ip.gsub!(Regexp.union(Resolv::IPv4::Regex, Resolv::IPv6::Regex), '\0') || 'bogus address' end def render_atom(hide_description = false, limit = 15)