Opened 11 years ago
Last modified 11 years ago
#10696 closed enhancement
Provide a fix for website's with no scheme — at Version 2
Reported by: | brianegge | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 14.11 |
Component: | Core validator | Version: | |
Keywords: | Cc: |
Description (last modified by )
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.
-
src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
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 } 302 308
Change History (2)
comment:1 by , 11 years ago
Description: | modified (diff) |
---|
comment:2 by , 11 years ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.