Anemone::Page#links: restored upwards dir traversal

[FIXRM #7853]
unstable
Tasos Laskos 2013-03-29 23:07:46 +02:00
parent 714fc83cfe
commit e9b183cda2
1 changed files with 12 additions and 8 deletions

View File

@ -107,13 +107,17 @@ module Anemone
to_absolute( URI( u.path.gsub( /(.*\/)[^\/]+$/, "\\1" ) ) ) rescue next
end.uniq.compact
@links |= @links.map do |u|
nlinks = []
@links.each do |u|
bits = u.path.split('/')
while bits.length > 0
while(bits.length > 0)
bits.pop
to_absolute( URI( bits.join( '/' ) ) ) rescue next
j = bits.join('/')
j = '/' if j.empty?
nlinks << to_absolute(URI(j)) rescue next
end
end.uniq.compact
end
@links |= nlinks
@links.flatten!
@links.uniq!