fix crash on parsing of empty lines, update drone and gitignore
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simon Marsh 2022-08-15 18:45:43 +01:00
parent 9314f4397d
commit 7993c9f7ed
Signed by: burble
GPG Key ID: 0FCCD13AE1CF7ED8
3 changed files with 111 additions and 40 deletions

View File

@ -26,7 +26,7 @@ steps:
secret_key:
from_secret: MINIO_SECRET_KEY
endpoint: https://minio.burble.dn42
region: uk-lon3
region: fr-par1
path_style: true
source: dn42regsrv
target: /dn42regsrv/${DRONE_BRANCH}
@ -40,7 +40,7 @@ steps:
secret_key:
from_secret: MINIO_SECRET_KEY
endpoint: https://minio.burble.dn42
region: uk-lon3
region: fr-par1
path_style: true
source: staticroot.tar.gz
target: /dn42regsrv/${DRONE_BRANCH}

68
.gitignore vendored Normal file
View File

@ -0,0 +1,68 @@
# ---> Go
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
# ---> Emacs
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
dist/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
# directory configuration
.dir-locals.el
# network security
/network-security.data
dn42regsrv

View File

@ -348,13 +348,17 @@ func loadAttributes(path string) []*RegAttribute {
line := strings.TrimRight(scanner.Text(), "\r\n")
// skip empty lines
if len(line) == 0 {
continue
}
// lines starting with '+' denote an empty line
if line[0] == '+' {
// concatenate a \n on to the previous attribute value
attributes[len(attributes)-1].RawValue += "\n"
} else {
continue
}
// look for a : separator in the first 20 characters
ix := strings.IndexByte(line, ':')
@ -399,7 +403,6 @@ func loadAttributes(path string) []*RegAttribute {
attributes = append(attributes, a)
}
}
}
return attributes
}