Commit eb3b0105 authored by Mygod's avatar Mygod

Fix 'Fix #1064'

parent 17bedaff
...@@ -88,10 +88,9 @@ class Acl { ...@@ -88,10 +88,9 @@ class Acl {
override def toString: String = { override def toString: String = {
val result = new StringBuilder() val result = new StringBuilder()
result.append(if (bypass) "[bypass_all]\n" else "[proxy_all]\n") result.append(if (bypass) "[bypass_all]\n" else "[proxy_all]\n")
var bypassList = bypassHostnames.toStream val (bypassList, proxyList) =
var proxyList = proxyHostnames.toStream if (bypass) (bypassHostnames.toStream, subnets.toStream.map(_.toString) #::: proxyHostnames.toStream)
if (bypass) proxyList = subnets.toStream.map(_.toString) #::: bypassList else (subnets.toStream.map(_.toString) #::: bypassHostnames.toStream, proxyHostnames.toStream)
else bypassList = subnets.toStream.map(_.toString) #::: proxyList
if (bypassList.nonEmpty) { if (bypassList.nonEmpty) {
result.append("[bypass_list]\n") result.append("[bypass_list]\n")
result.append(bypassList.mkString("\n")) result.append(bypassList.mkString("\n"))
......
...@@ -208,13 +208,15 @@ class CustomRulesFragment extends ToolbarFragment with Toolbar.OnMenuItemClickLi ...@@ -208,13 +208,15 @@ class CustomRulesFragment extends ToolbarFragment with Toolbar.OnMenuItemClickLi
def getSectionTitle(i: Int): String = { def getSectionTitle(i: Int): String = {
val j = i - acl.subnets.size val j = i - acl.subnets.size
try (if (j < 0) acl.subnets(i).address.getHostAddress.substring(0, 1) else { try {
(if (j < 0) acl.subnets(i).address.getHostAddress.substring(0, 1) else {
val hostname = acl.proxyHostnames(i) val hostname = acl.proxyHostnames(i)
PATTERN_DOMAIN.findFirstMatchIn(hostname) match { PATTERN_DOMAIN.findFirstMatchIn(hostname) match {
case Some(m) => m.matched.replaceAll("\\\\.", ".") // don't convert IDN yet case Some(m) => m.matched.replaceAll("\\\\.", ".") // don't convert IDN yet
case None => hostname case None => hostname
} }
}).substring(0, 1) catch { }).substring(0, 1)
} catch {
case _: IndexOutOfBoundsException => " " case _: IndexOutOfBoundsException => " "
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment