mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 21:45:50 +01:00
(refs #445)Fix yen to backslash
This commit is contained in:
@@ -102,7 +102,7 @@ object JGitUtil {
|
|||||||
/**
|
/**
|
||||||
* the line separator of this content ("LF" or "CRLF")
|
* the line separator of this content ("LF" or "CRLF")
|
||||||
*/
|
*/
|
||||||
val lineSeparator: String = if(content.exists(_.indexOf("¥r¥n") >= 0)) "CRLF" else "LF"
|
val lineSeparator: String = if(content.exists(_.indexOf("\r\n") >= 0)) "CRLF" else "LF"
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -54,9 +54,9 @@ object StringUtil {
|
|||||||
* @return the converted content
|
* @return the converted content
|
||||||
*/
|
*/
|
||||||
def convertLineSeparator(content: String, lineSeparator: String): String = {
|
def convertLineSeparator(content: String, lineSeparator: String): String = {
|
||||||
val lf = content.replaceAll("¥r¥n", "¥n").replaceAll("¥r", "¥n")
|
val lf = content.replace("\r\n", "\n").replace("\r", "\n")
|
||||||
if(lineSeparator == "CRLF"){
|
if(lineSeparator == "CRLF"){
|
||||||
lf.replaceAll("¥n", "¥r¥n")
|
lf.replace("\n", "\r\n")
|
||||||
} else {
|
} else {
|
||||||
lf
|
lf
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user