Fix 'Fix #1064'
This commit is contained in:
@@ -88,10 +88,9 @@ class Acl {
|
||||
override def toString: String = {
|
||||
val result = new StringBuilder()
|
||||
result.append(if (bypass) "[bypass_all]\n" else "[proxy_all]\n")
|
||||
var bypassList = bypassHostnames.toStream
|
||||
var proxyList = proxyHostnames.toStream
|
||||
if (bypass) proxyList = subnets.toStream.map(_.toString) #::: bypassList
|
||||
else bypassList = subnets.toStream.map(_.toString) #::: proxyList
|
||||
val (bypassList, proxyList) =
|
||||
if (bypass) (bypassHostnames.toStream, subnets.toStream.map(_.toString) #::: proxyHostnames.toStream)
|
||||
else (subnets.toStream.map(_.toString) #::: bypassHostnames.toStream, proxyHostnames.toStream)
|
||||
if (bypassList.nonEmpty) {
|
||||
result.append("[bypass_list]\n")
|
||||
result.append(bypassList.mkString("\n"))
|
||||
|
||||
@@ -208,13 +208,15 @@ class CustomRulesFragment extends ToolbarFragment with Toolbar.OnMenuItemClickLi
|
||||
|
||||
def getSectionTitle(i: Int): String = {
|
||||
val j = i - acl.subnets.size
|
||||
try (if (j < 0) acl.subnets(i).address.getHostAddress.substring(0, 1) else {
|
||||
val hostname = acl.proxyHostnames(i)
|
||||
PATTERN_DOMAIN.findFirstMatchIn(hostname) match {
|
||||
case Some(m) => m.matched.replaceAll("\\\\.", ".") // don't convert IDN yet
|
||||
case None => hostname
|
||||
}
|
||||
}).substring(0, 1) catch {
|
||||
try {
|
||||
(if (j < 0) acl.subnets(i).address.getHostAddress.substring(0, 1) else {
|
||||
val hostname = acl.proxyHostnames(i)
|
||||
PATTERN_DOMAIN.findFirstMatchIn(hostname) match {
|
||||
case Some(m) => m.matched.replaceAll("\\\\.", ".") // don't convert IDN yet
|
||||
case None => hostname
|
||||
}
|
||||
}).substring(0, 1)
|
||||
} catch {
|
||||
case _: IndexOutOfBoundsException => " "
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user