Project

General

Profile

Patch #37591 ยป use_start_with.patch

Go MAEDA, 2022-08-22 11:19

View differences:

lib/redmine/diff_table.rb
118 118
    end
119 119

  
120 120
    def parse_line(line, type="inline")
121
      if line[0, 1] == "+"
121
      if line.start_with?('+')
122 122
        diff = diff_for_added_line
123 123
        diff.line_right = line[1..-1]
124 124
        diff.nb_line_right = @line_num_r
......
126 126
        @line_num_r += 1
127 127
        @added += 1
128 128
        true
129
      elsif line[0, 1] == "-"
129
      elsif line.start_with?('-')
130 130
        diff = Diff.new
131 131
        diff.line_left = line[1..-1]
132 132
        diff.nb_line_left = @line_num_l
......
137 137
        true
138 138
      else
139 139
        write_offsets
140
        if /\s/.match?(line[0, 1])
140
        if line.start_with?(/\s/)
141 141
          diff = Diff.new
142 142
          diff.line_right = line[1..-1]
143 143
          diff.nb_line_right = @line_num_r
......
187 187
      end
188 188
    end
189 189
  end
190
end
190
end
lib/redmine/export/pdf.rb
120 120
        end
121 121

  
122 122
        def get_sever_url(url)
123
          if !empty_string(url) and (url[0, 1] == '/')
123
          if !empty_string(url) and url.start_with?('/')
124 124
            Setting.host_name.split('/')[0] + url
125 125
          else
126 126
            url
lib/redmine/scm/adapters/abstract_adapter.rb
158 158

  
159 159
        def with_leading_slash(path)
160 160
          path ||= ''
161
          (path[0, 1]!="/") ? "/#{path}" : path
161
          path.start_with?('/') ? path : "/#{path}"
162 162
        end
163 163

  
164 164
        def with_trailling_slash(path)
165 165
          path ||= ''
166
          (path[-1, 1] == "/") ? path : "#{path}/"
166
          path.end_with?('/') ? path : "#{path}/"
167 167
        end
168 168

  
169 169
        def without_leading_slash(path)
......
173 173

  
174 174
        def without_trailling_slash(path)
175 175
          path ||= ''
176
          (path[-1, 1] == "/") ? path[0..-2] : path
176
          path.end_with?('/') ? path[0..-2] : path
177 177
        end
178 178

  
179 179
        def valid_name?(name)
    (1-1/1)