Flowdock
normalize_path(path) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/webrick/httputils.rb, line 21
    def normalize_path(path)
      raise "abnormal path `#{path}'" if path[0] != //
      ret = path.dup

      ret.gsub!(%{/+}, '/')                    # //      => /
      while ret.sub!(%/\.(?:/|\Z)', '/'); end  # /.      => /
      while ret.sub!(%/(?!\.\./)[^/]+/\.\.(?:/|\Z)', '/'); end # /foo/.. => /foo

      raise "abnormal path `#{path}'" if %{/\.\.(/|\Z)} =~ ret
      ret
    end
Register or log in to add new notes.