mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-10 23:45:50 +01:00
(refs #445)Keep line separator in online file editing
This commit is contained in:
@@ -46,6 +46,22 @@ object StringUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts line separator in the given content.
|
||||
*
|
||||
* @param content the content
|
||||
* @param lineSeparator "LF" or "CRLF"
|
||||
* @return the converted content
|
||||
*/
|
||||
def convertLineSeparator(content: String, lineSeparator: String): String = {
|
||||
val lf = content.replaceAll("¥r¥n", "¥n").replaceAll("¥r", "¥n")
|
||||
if(lineSeparator == "CRLF"){
|
||||
lf.replaceAll("¥n", "¥r¥n")
|
||||
} else {
|
||||
lf
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract issue id like ```#issueId``` from the given message.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user