On Jun 5, 2006, at 10:45 AM, Stuart Brand wrote: > Thanks all, this worked fine > > def self.path(path) > fileLine = path[1].strip > fileLine = fileLine.gsub(/\.\//, '') > fileLine = fileLine.gsub(/\/\./, '') > fileLine = fileLine.gsub(/\\/, '') > fileLine = fileLine.gsub(/\.{2,}/, '') > fileLine = fileLine.gsub(/\/{2,}/, '') > fileLine = "/srv/www/htdocs/" + fileLine > return fileLine > end > > Is there a way of making it look prettier? > > I'm trying to stop people using the address bar to access parts of the > system the should not > > Many thanks all > > Stuart def self.path(path) [/\.\//, /\/\./, /\\/, /\.{2,}/, /\/{2,}/].each do |exp| fileLine.gsub!(exp, '') end "/srv/www/htdocs/" + fileLine end