[PR #1871] [MERGED] fix: TickTick import #3749

Closed
opened 2026-03-22 14:53:04 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/1871
Author: @kolaente
Created: 11/25/2025
Status: Merged
Merged: 11/25/2025
Merged by: @kolaente

Base: mainHead: fix-ticktick-import


📝 Commits (10+)

📊 Changes

6 files changed (+554 additions, -22 deletions)

View changed files

📝 go.sum (+0 -6)
pkg/modules/migration/ticktick/main_test.go (+32 -0)
pkg/modules/migration/ticktick/testdata_ticktick_export.csv (+18 -0)
pkg/modules/migration/ticktick/testdata_ticktick_multiline.csv (+14 -0)
📝 pkg/modules/migration/ticktick/ticktick.go (+77 -15)
📝 pkg/modules/migration/ticktick/ticktick_test.go (+413 -1)

📄 Description

This change fixes a few issues with the TickTick import:

  1. BOM (Byte Order Mark) Handling: Added stripBOM() function to properly handle UTF-8 BOM at the beginning of CSV files
  2. Multi-line Status Section: Updated header detection to handle the multi-line status description in real TickTick exports
  3. CSV Parser Configuration: Made the CSV parser more lenient with variable field counts and quote handling
  4. Test Infrastructure: Added missing logger initialization for tests
  5. Field Mapping: Fixed the core issue where CSV fields weren't being mapped to struct fields correctly

The main problem was in the newLineSkipDecoder function where:

  • Header detection calculated line skip count on BOM-stripped content
  • CSV decoder was also stripping BOM and applying the same skip count
  • This caused inconsistent positioning and empty field mapping

Rewrote the decoder to use a scanner-based approach with consistent BOM handling.

Resolves https://github.com/go-vikunja/vikunja/issues/1870


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/1871 **Author:** [@kolaente](https://github.com/kolaente) **Created:** 11/25/2025 **Status:** ✅ Merged **Merged:** 11/25/2025 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix-ticktick-import` --- ### 📝 Commits (10+) - [`46f1b8e`](https://github.com/go-vikunja/vikunja/commit/46f1b8e569d10fc4d482798fc757e16cd9c1ea88) fix: TickTick import - [`90f9dc3`](https://github.com/go-vikunja/vikunja/commit/90f9dc3dabb1f81b7bd308c6a6fbba52c3c3ac0a) fix: empty labels - [`458b2aa`](https://github.com/go-vikunja/vikunja/commit/458b2aae5abd5b0c08e1780ed80f983a549e735b) refactor tests - [`e8c3d1d`](https://github.com/go-vikunja/vikunja/commit/e8c3d1d146dadf2cddb8ea0840f434d86cbccb89) fix lint - [`31f6c06`](https://github.com/go-vikunja/vikunja/commit/31f6c06d45af362cee1ed1a997a72cc2d7299987) fix lint - [`2950d00`](https://github.com/go-vikunja/vikunja/commit/2950d00c668a189a47fa0443558d7af920f4146a) fix - [`71e0855`](https://github.com/go-vikunja/vikunja/commit/71e0855a9a5678110899d5d35cd1f23d810803b0) fix more - [`f21663e`](https://github.com/go-vikunja/vikunja/commit/f21663ece878ab7db06f68629d7468e65d439952) add multiline tests - [`50f57e0`](https://github.com/go-vikunja/vikunja/commit/50f57e000b3b7a2735d6d16b8f4379dcfbcd814b) morefixes - [`fbe16af`](https://github.com/go-vikunja/vikunja/commit/fbe16afbc9a62aa5049c5c5270bc2020b66d46a4) require no error ### 📊 Changes **6 files changed** (+554 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `go.sum` (+0 -6) ➕ `pkg/modules/migration/ticktick/main_test.go` (+32 -0) ➕ `pkg/modules/migration/ticktick/testdata_ticktick_export.csv` (+18 -0) ➕ `pkg/modules/migration/ticktick/testdata_ticktick_multiline.csv` (+14 -0) 📝 `pkg/modules/migration/ticktick/ticktick.go` (+77 -15) 📝 `pkg/modules/migration/ticktick/ticktick_test.go` (+413 -1) </details> ### 📄 Description This change fixes a few issues with the TickTick import: 1. BOM (Byte Order Mark) Handling: Added stripBOM() function to properly handle UTF-8 BOM at the beginning of CSV files 2. Multi-line Status Section: Updated header detection to handle the multi-line status description in real TickTick exports 3. CSV Parser Configuration: Made the CSV parser more lenient with variable field counts and quote handling 4. Test Infrastructure: Added missing logger initialization for tests 5. Field Mapping: Fixed the core issue where CSV fields weren't being mapped to struct fields correctly The main problem was in the newLineSkipDecoder function where: - Header detection calculated line skip count on BOM-stripped content - CSV decoder was also stripping BOM and applying the same skip count - This caused inconsistent positioning and empty field mapping Rewrote the decoder to use a scanner-based approach with consistent BOM handling. Resolves https://github.com/go-vikunja/vikunja/issues/1870 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-22 14:53:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#3749