Properly handle invalid characters in identifiers for Wordpress
This commit is contained in:
@@ -83,8 +83,12 @@ public class WordpressDirectoryProvider implements IDirectoryProvider {
|
|||||||
|
|
||||||
while (rSet.next()) {
|
while (rSet.next()) {
|
||||||
processRow(rSet).ifPresent(e -> {
|
processRow(rSet).ifPresent(e -> {
|
||||||
|
try {
|
||||||
e.setUserId(MatrixID.from(e.getUserId(), mxCfg.getDomain()).valid().getId());
|
e.setUserId(MatrixID.from(e.getUserId(), mxCfg.getDomain()).valid().getId());
|
||||||
result.addResult(e);
|
result.addResult(e);
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
log.warn("Ignoring result {} - Invalid characters for a Matrix ID", e.getUserId());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -87,10 +87,14 @@ public class WordpressThreePidProvider implements IThreePidProvider {
|
|||||||
while (rSet.next()) {
|
while (rSet.next()) {
|
||||||
String uid = rSet.getString("uid");
|
String uid = rSet.getString("uid");
|
||||||
log.info("Found match: {}", uid);
|
log.info("Found match: {}", uid);
|
||||||
|
try {
|
||||||
return Optional.of(MatrixID.from(uid, mxCfg.getDomain()).valid());
|
return Optional.of(MatrixID.from(uid, mxCfg.getDomain()).valid());
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
log.warn("Ignoring match {} - Invalid characters for a Matrix ID", uid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("No match found in Wordpress");
|
log.info("No valid match found in Wordpress");
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
Reference in New Issue
Block a user