diff --git a/modules/test-e2e/src/test/scala/org/knora/webapi/slice/resources/api/ValuesEndpointsE2ESpec.scala b/modules/test-e2e/src/test/scala/org/knora/webapi/slice/resources/api/ValuesEndpointsE2ESpec.scala index e50f4ab423..55e8566a93 100644 --- a/modules/test-e2e/src/test/scala/org/knora/webapi/slice/resources/api/ValuesEndpointsE2ESpec.scala +++ b/modules/test-e2e/src/test/scala/org/knora/webapi/slice/resources/api/ValuesEndpointsE2ESpec.scala @@ -2614,7 +2614,7 @@ object ValuesEndpointsE2ESpec extends E2EZSpec { self => }, test("update a text value with a comment") { val resourceIri: IRI = AThing.iri - val valueAsString: String = "this is a text value that has an updated comment" + val valueAsString: String = "this is a text value that has a 'thoroughly' updated comment" val valueHasComment: String = "this is an updated comment" val propertyIri: SmartIri = "http://0.0.0.0:3333/ontology/0001/anything/v2#hasText".toSmartIri diff --git a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/valuemessages/ValueMessagesV2.scala b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/valuemessages/ValueMessagesV2.scala index 5182a46e8b..43a771f1f8 100644 --- a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/valuemessages/ValueMessagesV2.scala +++ b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/valuemessages/ValueMessagesV2.scala @@ -1206,11 +1206,12 @@ object TextValueContentV2 { ) } - private def objectSparqlStringOption(r: Resource, property: String) = for { + private def objectSparqlStringOption(r: Resource, property: String): Either[String, Option[String]] = for { str <- r.objectStringOption(property) iri <- str match - case Some(s) => Right(Iri.toSparqlEncodedString(s)) - case None => Right(None) + case Some(s) if s.strip.isEmpty => Right(None) + case None => Right(None) + case Some(s) => Right(Some(s)) } yield iri def from(r: Resource): ZIO[MessageRelay, IRI, TextValueContentV2] = for { @@ -1228,7 +1229,6 @@ object TextValueContentV2 { textValue <- getTextValue(maybeValueAsString, maybeTextValueAsXml, maybeValueHasLanguage, maybeMappingResponse, comment) .mapError(_.getMessage) - } yield textValue }