0002-fix-for-5548-escaping-in-svn-urls.patch

Gregor Schmidt, 2010-06-20 15:15

Download (3.71 KB)

View differences:

lib/redmine/scm/adapters/subversion_adapter.rb
47 47
        
48 48
        # Get info about the svn repository
49 49
        def info
50
          cmd = "#{SVN_BIN} info --xml #{target('')}"
50
          cmd = "#{SVN_BIN} info --xml #{target}"
51 51
          cmd << credentials_string
52 52
          info = nil
53 53
          shellout(cmd) do |io|
......
77 77
          path ||= ''
78 78
          identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
79 79
          entries = Entries.new
80
          cmd = "#{SVN_BIN} list --xml #{target(URI.escape(path))}@#{identifier}"
80
          cmd = "#{SVN_BIN} list --xml #{target(path)}@#{identifier}"
81 81
          cmd << credentials_string
82 82
          shellout(cmd) do |io|
83 83
            output = io.read
......
116 116
          return nil unless self.class.client_version_above?([1, 5, 0])
117 117
          
118 118
          identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
119
          cmd = "#{SVN_BIN} proplist --verbose --xml #{target(URI.escape(path))}@#{identifier}"
119
          cmd = "#{SVN_BIN} proplist --verbose --xml #{target(path)}@#{identifier}"
120 120
          cmd << credentials_string
121 121
          properties = {}
122 122
          shellout(cmd) do |io|
......
142 142
          cmd << credentials_string
143 143
          cmd << " --verbose " if  options[:with_paths]
144 144
          cmd << " --limit #{options[:limit].to_i}" if options[:limit]
145
          cmd << ' ' + target(URI.escape(path))
145
          cmd << ' ' + target(path)
146 146
          shellout(cmd) do |io|
147 147
            output = io.read
148 148
            begin
......
180 180
          cmd = "#{SVN_BIN} diff -r "
181 181
          cmd << "#{identifier_to}:"
182 182
          cmd << "#{identifier_from}"
183
          cmd << " #{target(URI.escape(path))}@#{identifier_from}"
183
          cmd << " #{target(path)}@#{identifier_from}"
184 184
          cmd << credentials_string
185 185
          diff = []
186 186
          shellout(cmd) do |io|
......
194 194
        
195 195
        def cat(path, identifier=nil)
196 196
          identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
197
          cmd = "#{SVN_BIN} cat #{target(URI.escape(path))}@#{identifier}"
197
          cmd = "#{SVN_BIN} cat #{target(path)}@#{identifier}"
198 198
          cmd << credentials_string
199 199
          cat = nil
200 200
          shellout(cmd) do |io|
......
207 207
        
208 208
        def annotate(path, identifier=nil)
209 209
          identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
210
          cmd = "#{SVN_BIN} blame #{target(URI.escape(path))}@#{identifier}"
210
          cmd = "#{SVN_BIN} blame #{target(path)}@#{identifier}"
211 211
          cmd << credentials_string
212 212
          blame = Annotate.new
213 213
          shellout(cmd) do |io|
......
243 243
            end
244 244
          end
245 245
        end
246

  
247
        def target(path = '')
248
          base = path.match(/^\//) ? root_url : url
249
          uri = "#{base}/#{path}"
250
          uri = URI.escape(URI.escape(uri), '[]')
251
          shell_quote(uri.gsub(/[?<>\*]/, ''))
252
        end
246 253
      end
247 254
    end
248 255
  end
249
-