Skip to content
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

Handle line-breaks in address field #72

Closed
korelstar opened this issue Dec 26, 2016 · 6 comments
Closed

Handle line-breaks in address field #72

korelstar opened this issue Dec 26, 2016 · 6 comments
Labels
wontfix This will not be worked on

Comments

@korelstar
Copy link
Member

This may affect not only the address field. However, this is the field, where it is annoying. Furthermore, this issue was also reported in owncloud/contacts#519 (without a fix at the moment).

Steps to reproduce

  1. Add a line-break to the value of the address field using an external client (e.g. on your Android mobile phone). Example:
Part1
Part2
  1. Sync the client with Nextcloud (e.g. using DAVdroid)
  2. Open the contact with Nextcloud Contacts.

Expected behaviour

The address field should contain the line-break between Part1 and Part2.

Actual behaviour

The value of the address field is Part1Part2, i.e. the line-break is removed. However, the database (oc_cards and oc_cards_properties) contains the correct value for ADR: ;;Part1\nPart2;;;;.

Server configuration

Operating system: Debian jessie
Web server: Apache 2.4.10
Database: MySQL 5.5.53
PHP version: 5.6.29
Nextcloud version: 10.0.2
Contacts version: 1.5.2

Client configuration

Browser: Firefox ESR 45.6.0
Operating system: Debian jessie
CardDAV-clients: DAVdroid / Android

@skjnldsv
Copy link
Member

Line break are allowed in ADR fields: https://tools.ietf.org/html/rfc6350#page-34

@skjnldsv skjnldsv added 1. to develop Accepted and waiting to be taken care of bug Something isn't working enhancement New feature or request labels Dec 29, 2016
@skjnldsv
Copy link
Member

Hum, I was wrong, the line breaks are only on the LABEL data.
I'm not sure line break are allowed inside.

Meanwhile, on android stock 6.0, the contact manager doesn't have detailed adr fields. So you have to enter empty lines for it to be displayed correctly.

I don't know if there is a good way to do that.
I guess for now we should probably just put a warning on contacts that have empty lines in theirs adr fields and not allow empty lines on nextcloud.

@skjnldsv skjnldsv added wontfix This will not be worked on and removed 1. to develop Accepted and waiting to be taken care of bug Something isn't working enhancement New feature or request labels Dec 29, 2016
@korelstar
Copy link
Member Author

Hum, I was wrong, the line breaks are only on the LABEL data.
I'm not sure line break are allowed inside.

Obviously, line-breaks are allowed in all ADR components:

ADR-component-street = list-component
list-component = component *("," component)
component = "\\" / "\," / "\;" / "\n" / WSP / NON-ASCII / %x21-2B / %x2D-3A / %x3C-5B / %x5D-7E

Hence, it is standard-conform to use line-breaks in ADR-fields as shown in my example above.

Meanwhile, on android stock 6.0, the contact manager doesn't have detailed adr fields. So you have to enter empty lines for it to be displayed correctly.

I don't know if there is a good way to do that.
I guess for now we should probably just put a warning on contacts that have empty lines in theirs adr fields and not allow empty lines on nextcloud.

With "empty lines", do you mean "line-breaks"?
From my point of view, a warning is not sufficient here. At least, line-breaks should be replaced by a space or comma character. A better approach would to replace the <input> field by a <textarea> field if the field value contains any line-breaks.

@skjnldsv
Copy link
Member

skjnldsv commented Dec 29, 2016

  The text components are separated by the SEMICOLON character
  (U+003B).  Where it makes semantic sense, individual text
  components can include multiple text values (e.g., a "street"
  component with multiple lines) separated by the COMMA character
  (U+002C).

No \n allowed on ADR properties except from LABEL:

  The property can also include a "LABEL" parameter to present a
  delivery address label for the address.  Its value is a plain-text
  string representing the formatted address.  Newlines are encoded
  as \n, as they are for property values.

@korelstar
Copy link
Member Author

Sorry, but I can't see any note that line-breaks are disallowed. Maybe, the standard is ambiguous, here. However, the ABNF clearly allows them. And you noticed already, that for Android clients, it is obvious to use line-breaks for an address.

@skjnldsv
Copy link
Member

I'm reading directly from the vcard rfc. If it says that new lines should be comma (U+002C) in the adr fields, then that's what we should do. Because android doesn't fit the rfc rules doesn't mean we should do the same ;)

I don't know why android removed the detailed address fields. I never noticed it before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants