From 4e84166db5c5538e3984d9d2d6bb1f9902e65ee0 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Tue, 04 Nov 2014 17:38:17 -0500
Subject: [PATCH] Merged #217 "Exclude SSLv3 from Gitblit GO https protocols"

---
 src/main/java/com/gitblit/utils/StringUtils.java |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/gitblit/utils/StringUtils.java b/src/main/java/com/gitblit/utils/StringUtils.java
index 5813c3a..087de54 100644
--- a/src/main/java/com/gitblit/utils/StringUtils.java
+++ b/src/main/java/com/gitblit/utils/StringUtils.java
@@ -129,6 +129,8 @@
 				retStr.append("%20");
 			} else if (inStr.charAt(i) == '&') {
 				retStr.append("%26");
+			} else if (inStr.charAt(i) == '+') {
+				retStr.append("%2B");
 			} else {
 				retStr.append(inStr.charAt(i));
 			}
@@ -307,7 +309,7 @@
 	 * @param bytes
 	 * @return byte array as hex string
 	 */
-	private static String toHex(byte[] bytes) {
+	public static String toHex(byte[] bytes) {
 		StringBuilder sb = new StringBuilder(bytes.length * 2);
 		for (int i = 0; i < bytes.length; i++) {
 			if ((bytes[i] & 0xff) < 0x10) {
@@ -398,7 +400,7 @@
 	 * @return the first invalid character found or null if string is acceptable
 	 */
 	public static Character findInvalidCharacter(String name) {
-		char[] validChars = { '/', '.', '_', '-', '~' };
+		char[] validChars = { '/', '.', '_', '-', '~', '+' };
 		for (char c : name.toCharArray()) {
 			if (!Character.isLetterOrDigit(c)) {
 				boolean ok = false;
@@ -642,7 +644,7 @@
 				// ignore unsupported charsets
 			}
 		}
-		if (value.startsWith("\uFEFF")) {
+		if (value != null && value.startsWith("\uFEFF")) {
 			// strip UTF-8 BOM
             return value.substring(1);
         }

--
Gitblit v1.9.1