Skip to content

vCard middle name handling #678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

plew99
Copy link

@plew99 plew99 commented Jun 28, 2025

Fixes #605


This change is Reviewable

@cytadela8 cytadela8 changed the title Fixes warsztatywww#605 vCard middle name handling Jun 29, 2025
@cytadela8 cytadela8 requested a review from Copilot June 29, 2025 08:35
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the vCard export logic by correctly handling names containing middle names and arbitrary whitespace.

  • Switches from a two-item split to a whitespace-based split for full name parsing
  • Assigns firstName as the first token and lastName as the last token, ignoring middle tokens
  • Trims the input to remove leading/trailing whitespace
Comments suppressed due to low confidence (2)

frontend/js/datatables_vcard_export.ts:37

  • [nitpick] Consider renaming names to nameParts or tokens to better convey that this array represents individual parts of the full name.
            const names = row[columnName].trim().split(/\s+/);

frontend/js/datatables_vcard_export.ts:37

  • Add a unit test for vcard_export to cover cases where the name contains more than two words (middle names) to ensure first and last tokens are handled correctly.
            const names = row[columnName].trim().split(/\s+/);

@cytadela8
Copy link
Member

A better solution would be to take all, but last word as first name and last word as last name.

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.

vCard middle name handling
2 participants