diff --git a/services/ical/service/ical/icalDescriptionGenerator.go b/services/ical/service/ical/icalDescriptionGenerator.go index 4c2fc35..8b5fbfc 100644 --- a/services/ical/service/ical/icalDescriptionGenerator.go +++ b/services/ical/service/ical/icalDescriptionGenerator.go @@ -111,10 +111,12 @@ func generateRoomLinksForGoogleCalendar(rooms string) string { var description strings.Builder roomList := functions.SeperateRoomString(rooms) - description.WriteString("Orte: \n") - for _, room := range roomList { - roomLink := functions.MapRoom(room, true) - description.WriteString(" " + room + " \n") + if !functions.OnlyWhitespace(rooms) { + description.WriteString("Orte: ") + for _, room := range roomList { + roomLink := functions.MapRoom(room, true) + description.WriteString(" " + room + " ") + } } return description.String() diff --git a/services/ical/service/ical/icalDescriptionGenerator_test.go b/services/ical/service/ical/icalDescriptionGenerator_test.go index d5d14b9..1fd992f 100644 --- a/services/ical/service/ical/icalDescriptionGenerator_test.go +++ b/services/ical/service/ical/icalDescriptionGenerator_test.go @@ -191,14 +191,14 @@ func Test_generateRoomLinksForGoogleCalendar(t *testing.T) { args: args{ rooms: "A123, ZU423, C789", }, - want: "Orte: \n A123 \n ZU423 \n C789 \n", + want: "Orte: A123 ZU423 C789 ", }, { name: "Test 2", args: args{ rooms: "A123", }, - want: "Orte: \n A123 \n", + want: "Orte: A123 ", }, } for _, tt := range tests { @@ -306,7 +306,7 @@ func Test_generateDescription(t *testing.T) { }, userAgent: "Google-Calendar-Importer", }, - description: "Profs: Dr. Smith\nGruppen: Math 101\nTyp: Lecture (mandatory)\nOrte: \n ZU423 \n FE231 \n", + description: "Profs: Dr. Smith\nGruppen: Math 101\nTyp: Lecture (mandatory)\nOrte: ZU423 FE231 ", altrep: "", }, }