Skip to content

Keep CSV-exported paths that contain "; " intact [patch] - #177

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/158-csv-path-separator
Sep 29, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/158-csv-path-separator

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #158

What was wrong

Export.BuildCsv joined an entry's KnownPaths with "; ", and Import.ParseCsv split the field on the same string. A path such as …/Photos/Smith; Jones wedding/IMG_001.jpg came back as two bogus paths. Depending on how the second fragment parsed, the row could also be dropped entirely.

Change

  • Export: every path now ends with \n. The field is already quoted (CSV export → import loses data: multi-paragraph descriptions are truncated and names with commas drop the row #149), so the line break round-trips, and no path contains one. Terminating every path rather than joining them means a single-path entry also carries the marker, so Import can tell the two formats apart.
  • Import: a new Import.SplitKnownPaths handles the field:
    • If the field contains a line break, it splits on line breaks, tolerating \r\n and dropping empty entries.
    • Otherwise it falls back to the old "; " split, so CSVs exported before this change still import as before.

Tests

In ImportTests:

  • CsvExportThenImportKeepsPathsThatContainTheOldSeparator: BuildCsv → ParseCsv round trip with two paths under Smith; Jones wedding/, one of them also named IMG_002; copy.jpg.
  • SplitKnownPathsReadsBothTheCurrentAndTheLegacyFormat: covers LF, CRLF, the legacy "; " format and an empty field.

With the Export.cs change reverted, CsvExportThenImportKeepsPathsThatContainTheOldSeparator fails. With the change, the full suite passes: 60 tests, 1 skipped as before because the root user can read every folder.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kj95GdQsZpSCcND7LqacT1


Generated by Claude Code

Export joined an entry's known paths with "; " and Import split on it, so
a folder such as "Smith; Jones wedding" came back as two bogus paths, or
the row was dropped. Export now ends every path with a line break, which
the quoted field already round-trips and no path contains. Import still
reads older exports that have no line break in the field as "; "-joined.

Fixes #158

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kj95GdQsZpSCcND7LqacT1
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 269e135 into main Sep 29, 2026
12 checks passed
@matt-edmondson
matt-edmondson deleted the fix/158-csv-path-separator branch September 29, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSV export/import splits a known path that contains "; " into two bogus paths (or drops the whole row)

2 participants