Changeset 18869 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
r18801 r18869 132 132 * Protocol scheme (e.g. http, ftp, https). 133 133 */ 134 private static final String SCHEME_REGEX = "^\\p{Alpha}[\\p{Alnum} \\+\\-\\.]*";134 private static final String SCHEME_REGEX = "^\\p{Alpha}[\\p{Alnum}+\\-.]*"; 135 135 private static final Pattern SCHEME_PATTERN = Pattern.compile(SCHEME_REGEX); 136 136 … … 138 138 // TODO does not allow for optional userinfo. 139 139 // Validation of character set is done by isValidAuthority 140 private static final String AUTHORITY_CHARS_REGEX = "\\p{Alnum} \\-\\."; // allows for IPV4 but not IPV6140 private static final String AUTHORITY_CHARS_REGEX = "\\p{Alnum}-\\."; // allows for IPV4 but not IPV6 141 141 private static final String IPV6_REGEX = "[0-9a-fA-F:]+"; // do this as separate match because : could cause ambiguity with port prefix 142 142 … … 151 151 USERINFO_CHARS_REGEX + "*@"; // password may be absent 152 152 private static final String AUTHORITY_REGEX = 153 "(?:\\[("+IPV6_REGEX+") \\]|(?:(?:"+USERINFO_FIELD_REGEX+")?([" + AUTHORITY_CHARS_REGEX + "]*)))(:\\d*)?(.*)?";153 "(?:\\[("+IPV6_REGEX+")]|(?:(?:"+USERINFO_FIELD_REGEX+")?([" + AUTHORITY_CHARS_REGEX + "]*)))(:\\d*)?(.*)?"; 154 154 // 1 e.g. user:pass@ 2 3 4 155 155 private static final Pattern AUTHORITY_PATTERN = Pattern.compile(AUTHORITY_REGEX); … … 164 164 private static final int PARSE_AUTHORITY_EXTRA = 4; 165 165 166 private static final String PATH_REGEX = "^(/[-\\w:@&?=+,.!/~*'%$_; \\(\\)]*)?$";167 private static final Pattern PATH_PATTERN = Pattern.compile(PATH_REGEX );166 private static final String PATH_REGEX = "^(/[-\\w:@&?=+,.!/~*'%$_;()]*)?$"; 167 private static final Pattern PATH_PATTERN = Pattern.compile(PATH_REGEX, Pattern.UNICODE_CHARACTER_CLASS); 168 168 169 169 private static final String QUERY_REGEX = "^(.*)$"; -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/UrlValidatorTest.java
r18690 r18869 565 565 new ResultPair("/test1/file", true), 566 566 new ResultPair("/..//file", false), 567 new ResultPair("/test1//file", false) 567 new ResultPair("/test1//file", false), 568 new ResultPair("/projekte-und-themen/eulen-falken-und-deren-nistkästen/trafotürme", true) 568 569 }; 569 570
Note:
See TracChangeset
for help on using the changeset viewer.