URLEncode the username
diff --git a/src/main/java/org/typo3/gerrit/plugins/avatars/typo3org/ExternalUrlAvatarProvider.java b/src/main/java/org/typo3/gerrit/plugins/avatars/typo3org/ExternalUrlAvatarProvider.java
index 6545b2b..8f29462 100644
--- a/src/main/java/org/typo3/gerrit/plugins/avatars/typo3org/ExternalUrlAvatarProvider.java
+++ b/src/main/java/org/typo3/gerrit/plugins/avatars/typo3org/ExternalUrlAvatarProvider.java
@@ -29,6 +29,7 @@
import org.slf4j.LoggerFactory;
import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -58,6 +59,14 @@
return null;
}
+ try {
+ username = URLEncoder.encode(username, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ Logger log = LoggerFactory.getLogger(ExternalUrlAvatarProvider.class);
+ log.warn("Weird thing, UTF-8 as encoding is not supported");
+ return null;
+ }
+
if (externalAvatarUrl == null) {
Logger log = LoggerFactory.getLogger(ExternalUrlAvatarProvider.class);
log.warn("Avatar URL is not configured, cannot show avatars. Please configure avatar.url in etc/gerrit.config");