Make it work when the xml content end with \s*

This commit is contained in:
COoL
2020-11-07 18:32:50 +08:00
parent 176dcdc7cc
commit 4df47be521

View File

@ -228,7 +228,7 @@ func IsValidDataType(dataType string) bool {
func checkDataType(content []byte) string {
if json.Valid(content) {
return "json"
} else if gregex.IsMatch(`^<.+>[\S\s]+<.+>$`, content) {
} else if gregex.IsMatch(`^<.+>[\S\s]+<.+>\s*$`, content) {
return "xml"
} else if !gregex.IsMatch(`[\n\r]*[\s\t\w\-\."]+\s*=\s*"""[\s\S]+"""`, content) && !gregex.IsMatch(`[\n\r]*[\s\t\w\-\."]+\s*=\s*'''[\s\S]+'''`, content) &&
((gregex.IsMatch(`^[\n\r]*[\w\-\s\t]+\s*:\s*".+"`, content) || gregex.IsMatch(`^[\n\r]*[\w\-\s\t]+\s*:\s*\w+`, content)) ||