diff --git a/internal/transformation/keepDescription.go b/internal/transformation/keepDescription.go index e22481b..75b61fc 100644 --- a/internal/transformation/keepDescription.go +++ b/internal/transformation/keepDescription.go @@ -4,8 +4,8 @@ import ( "strings" "github.com/aquilax/truncate" - "github.com/microcosm-cc/bluemonday" "github.com/inovex/CalendarSync/internal/models" + "github.com/microcosm-cc/bluemonday" ) // KeepDescription allows to keep the description of an event. @@ -16,8 +16,8 @@ func (t *KeepDescription) Name() string { } func (t *KeepDescription) Transform(source models.Event, sink models.Event) (models.Event, error) { - // need to remove microsoft html overhead - p := bluemonday.StrictPolicy() + // need to remove microsoft html overhead (the description in outlook contains a lot of '\r\n's) + p := bluemonday.UGCPolicy() description := strings.ReplaceAll(source.Description, "\r\n", "") sanitizedDescription := p.Sanitize(description) sanitizedDescription2 := strings.TrimSpace(sanitizedDescription) diff --git a/internal/transformation/keepDescription_test.go b/internal/transformation/keepDescription_test.go index f35c660..ab15da3 100644 --- a/internal/transformation/keepDescription_test.go +++ b/internal/transformation/keepDescription_test.go @@ -1,10 +1,11 @@ package transformation import ( - "github.com/stretchr/testify/assert" - "github.com/inovex/CalendarSync/internal/models" "strings" "testing" + + "github.com/inovex/CalendarSync/internal/models" + "github.com/stretchr/testify/assert" ) func TestKeepDescription_Transform(t *testing.T) { @@ -40,9 +41,15 @@ func TestKeepDescription_Transform(t *testing.T) { }, { name: "removes html from description", - sourceDescription: "