Skip to content

Scope PhoneNumberField trunk-0 strip to prefixes that use a national trunk zero #912

Description

@marassteiner

Summary

PhoneNumberField.updatePhoneNumber() strips a single leading 0 from the national part for every prefix. That is correct for the prefixes this field currently offers (+41, +49). It becomes wrong if the field later accepts prefixes whose leading 0 is a significant national digit (for example Italian +39 landlines).

Evidence

  • lib/widgets/form/phone_number_field.dart:48number!.startsWith('0') ? number!.substring(1) : number with no prefix check
  • lib/widgets/form/phone_number_field.dart:16 — current prefixes are only ['+41', '+49']
  • Parallel work on feat/open-phone-country-prefix already lets the user type a free 1–3 digit dial code. Combining that with this strip without a country allow-list would sign and store a mutated number.

Found while reviewing #910.

Suggested follow-up

  • Restrict the strip to prefixes that use a national trunk zero (at least +41 / +49; +43 / +423 if those stay in the known list).
  • When the open-prefix field lands, either keep a trunk-0 allow-list or reuse the same normalisation the API uses.
  • Add a preservation test for a prefix that must keep a leading 0 (for example +39 / 06…).

Not a merge blocker for #910: on today's +41/+49 surface the strip is the #905 fix and is covered by widget tests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions