[PATCH] Provide a fix for website's with no scheme
Frequently, the website tag is missing it's scheme. Id doesn't require this and it's not obvious that the scheme is required. The following patch will correct the scheme where it's obviously missing.
-
|
|
|
156 | 156 | private static final String PORT_REGEX = "^:(\\d{1,5})$"; |
157 | 157 | private static final Pattern PORT_PATTERN = Pattern.compile(PORT_REGEX); |
158 | 158 | |
| 159 | private static final String SIMPLE_WEBSITE = "^www[.].*"; |
| 160 | private static final Pattern SIMPLE_WEBSITE_PATTERN = Pattern.compile(SIMPLE_WEBSITE); |
| 161 | |
159 | 162 | /** |
160 | 163 | * Holds the set of current validation options. |
161 | 164 | */ |
… |
… |
|
297 | 300 | String scheme = urlMatcher.group(PARSE_URL_SCHEME); |
298 | 301 | if (!isValidScheme(scheme)) { |
299 | 302 | setErrorMessage(tr("URL contains an invalid protocol: {0}", scheme)); |
| 303 | if (SIMPLE_WEBSITE_PATTERN.matcher(value).matches()) { |
| 304 | setFix("http://" + value); |
| 305 | } |
300 | 306 | return false; |
301 | 307 | } |
Change History (7)
Description: |
modified (diff)
|
Description: |
modified (diff)
|
Summary: |
Provide a fix for website's with no scheme →
[PATCH] Provide a fix for website's with no scheme
|
Description: |
modified (diff)
|
Resolution: |
→ fixed
|
Status: |
new →
closed
|
In 7698/josm: