From e69edeaece2242f63128c15f9fd4d97a5d024508 Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Sat, 22 Mar 2025 16:15:02 +0100 Subject: [PATCH] fix(server): ValuePath: Do not check for errors if existence is optional --- server/doc-values/value-path.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/server/doc-values/value-path.go b/server/doc-values/value-path.go index 2ca9a8c..87f79ec 100644 --- a/server/doc-values/value-path.go +++ b/server/doc-values/value-path.go @@ -47,16 +47,16 @@ func (v PathValue) GetTypeDescription() []string { } func (v PathValue) DeprecatedCheckIsValid(value string) []*InvalidValue { + if v.RequiredType == PathTypeExistenceOptional { + return nil + } + if !utils.DoesPathExist(value) { - if v.RequiredType == PathTypeExistenceOptional { - return nil - } else { - return []*InvalidValue{{ - Err: PathDoesNotExistError{}, - Start: 0, - End: uint32(len(value)), - }} - } + return []*InvalidValue{{ + Err: PathDoesNotExistError{}, + Start: 0, + End: uint32(len(value)), + }} } isValid := false