Skip to content

Commit 91178dd

Browse files
committed
fix(Willhaben): Listing Node - description surrounded by quotes
1 parent dfc6f16 commit 91178dd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = "3.3.0"
1+
version = "3.3.1"

integration/willhaben/src/main/kotlin/me/snoty/integration/contrib/willhaben/api/WillhabenListing.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,24 @@ fun JsonObject.parseListing(json: Json): WillhabenListing {
2525
val id = this["id"]
2626
val attributes = getOrThrow("attributes").jsonObject.getOrThrow("attribute").jsonArray.associate {
2727
val key = it.jsonObject.getOrThrow("name").jsonPrimitive.content
28-
val value = it.jsonObject.getOrThrow("values").jsonArray.toList()
28+
val value = it.jsonObject.getOrThrow("values").jsonArray.map { item -> item.jsonPrimitive }
2929
key to value
3030
}
3131

3232
val title = getOrThrow("description").jsonPrimitive.content
33-
val description = attributes["DESCRIPTION"]
33+
val description = attributes["DESCRIPTION"]?.joinToString("\n") { it.content }
3434
?: throw IllegalArgumentException("Description not found in listing")
35-
val price = attributes["PRICE"]?.firstOrNull()?.jsonPrimitive?.doubleOrNull
35+
val price = attributes["PRICE"]?.firstOrNull()?.doubleOrNull
3636
?: throw IllegalArgumentException("Price not found in listing")
3737
val status: WillhabenStatus = json.decodeFromJsonElement(getOrThrow("advertStatus"))
3838

3939
return WillhabenListing(
4040
id = id!!.jsonPrimitive.content,
4141
title = title,
42-
description = description.joinToString("\n"),
42+
description = description,
4343
price = price,
4444
attributes = attributes.mapValues { (_, values) ->
45-
values.map { it.jsonPrimitive.content }
45+
values.map { it.content }
4646
},
4747
status = status,
4848
)

0 commit comments

Comments
 (0)