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

Unable to edit any contacts #1009

Closed
Lynnesbian opened this issue Mar 22, 2019 · 21 comments · Fixed by #1394
Closed

Unable to edit any contacts #1009

Lynnesbian opened this issue Mar 22, 2019 · 21 comments · Fixed by #1394
Labels
1. to develop Accepted and waiting to be taken care of blocked Waiting for a fix on one of our dependencies bug Something isn't working

Comments

@Lynnesbian
Copy link

Lynnesbian commented Mar 22, 2019

Describe the bug

When editing any field of a contact (e.g. adding or deleting an email address), a loading indicator appears, but nothing happens. An error is visible in the JavaScript console:

Unhandled promise rejection TypeError: "t.replace is not a function"

    _rfc6868Unescape https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 property https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 component https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 r https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 t https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:112 _ https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 _invoke https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 e https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 vn https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:91 a https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:91 yn https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:91 O https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 yn https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:91 updateContact https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:112 Ge https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:41 dispatch https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:47 dispatch https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:41 t https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:177 _ https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 _invoke https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 e https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 ar https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:177 a https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:177 sr https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:177 O https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 sr https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:177 updateContact https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:177 add https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 _tryToStartAnother https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 add https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 O https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 add https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 debounceUpdateContact https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:177 u https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:245 

contacts.js:7:155176

    e https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 exports https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 L https://[redacted]/apps/contacts/js/contacts.js?v=73c53709-20:7 v https://[redacted]/apps/notifications/js/notifications.js?v=73c53709-20:14 v https://[redacted]/apps/notifications/js/notifications.js?v=73c53709-20:14 s https://[redacted]/apps/notifications/js/notifications.js?v=73c53709-20:14 

To Reproduce
Steps to reproduce the behavior:

  1. Edit a contact with Firefox

Expected behavior
The edit is saved

Actual behavior
It stays loading forever and does not apply the update

Server configuration

Operating system: Linux

Web server: Nginx

Database: MariaDB

PHP version: 7.3

Nextcloud version: 15.0.5

Contacts version: 3.0.5

Updated from an older Nextcloud or fresh install: Updated from 14.x

Signing status:

No errors have been found.

List of activated apps:

Enabled:
  - accessibility: 1.1.0
  - activity: 2.8.2
  - admin_audit: 1.5.0
  - audioplayer: 2.6.1
  - bruteforcesettings: 1.3.0
  - calendar: 1.6.4
  - camerarawpreviews: 0.6.5
  - checksum: 0.4.2
  - cloud_federation_api: 0.1.0
  - comments: 1.5.0
  - contacts: 3.0.5
  - data_request: 1.2.0
  - dav: 1.8.1
  - drop_account: 0.1.0
  - encryption: 2.3.0
  - external: 3.2.0
  - federatedfilesharing: 1.5.0
  - federation: 1.5.0
  - files: 1.10.0
  - files_external: 1.6.0
  - files_markdown: 2.0.5
  - files_pdfviewer: 1.4.0
  - files_rightclick: 0.11.1
  - files_sharing: 1.7.0
  - files_texteditor: 2.7.0
  - files_trashbin: 1.5.0
  - files_versions: 1.8.0
  - files_videoplayer: 1.4.0
  - firstrunwizard: 2.4.0
  - gallery: 18.2.0
  - group_everyone: 0.1.1
  - groupfolders: 2.0.4
  - logreader: 2.0.0
  - lookup_server_connector: 1.3.0
  - metadata: 0.9.0
  - news: 13.1.4
  - nextcloud_announcements: 1.4.0
  - notes: 2.5.1
  - notifications: 2.3.0
  - oauth2: 1.3.0
  - password_policy: 1.5.0
  - provisioning_api: 1.5.0
  - qownnotesapi: 18.11.0
  - quota_warning: 1.4.0
  - ransomware_protection: 1.3.0
  - richdocuments: 3.2.4
  - serverinfo: 1.5.0
  - sharebymail: 1.5.0
  - socialsharing_email: 1.0.5
  - support: 1.0.0
  - survey_client: 1.3.0
  - systemtags: 1.5.0
  - theming: 1.6.0
  - twofactor_admin: 0.2.0
  - twofactor_backupcodes: 1.4.1
  - twofactor_gateway: 0.12.0
  - twofactor_nextcloud_notification: 1.0.3
  - twofactor_totp: 2.1.2
  - updatenotification: 1.5.0
  - w2g2: 2.2.4
  - workflow_script: 1.0.1
  - workflowengine: 1.5.0
Disabled:
  - caniupdate
  - drawio
  - end_to_end_encryption
  - fulltextsearch
  - fulltextsearch_elasticsearch
  - music
  - polls
  - tasks
  - unsplash
  - user_external
  - user_ldap

Nextcloud configuration:

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.lynnesbian.space"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "15.0.5.3",
        "overwrite.cli.url": "https:\/\/cloud.lynnesbian.space",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "maintenance": false,
        "loglevel": 2,
        "updater.release.channel": "stable",
        "theme": "",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "enable_previews": true,
        "enabledPreviewProviders": [
            "OC\\Preview\\Image",
            "OC\\Preview\\Movie",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\PDF"
        ]
    }
}

Client configuration

Browser: Firefox 65.0.1

Operating system: Linux

CardDAV-clients: N/A

Logs

Web server error log

N/A

Nextcloud log

data/nextcloud.log

N/A

Browser log

(see above)

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@nextcloud-bot nextcloud-bot added the 3. to review Waiting for reviews label Mar 22, 2019
@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #580 (Unable to add, remove or change contact entries), #163 (Contact delete tooltip), #33 (Contact image improvements), #136 (merging contact entries), and #70 (Merge duplicate contacts).

@nextcloud-bot nextcloud-bot added the bug Something isn't working label Mar 22, 2019
@skjnldsv
Copy link
Member

Hello!
Thanks for reporting!
I'm guessing your contacts is invalid and the parser can't read it.
Could you paste your vcf file here please? :)

@skjnldsv skjnldsv added needs info Not enough information provided 0. Needs triage and removed 3. to review Waiting for reviews labels Mar 22, 2019
@Lynnesbian
Copy link
Author

I downloaded the contact vCard and it seems to have a lot of custom values in it, such as X-SKYPE-USERNAME and X-ANDROID-CUSTOM:vnd.android.cursor.item/relation\;. I'm assuming these are what's tripping it up.

This contact file has been imported and exported from a bunch of different devices, so I guess that would be why it's full of invalid/weird data. I'll create a new contact with the same data. It's strange, though, because Nextcloud can display it just fine - albeit without the custom values.

Thank you!

@skjnldsv
Copy link
Member

I downloaded the contact vCard and it seems to have a lot of custom values in it, such as X-SKYPE-USERNAME and X-ANDROID-CUSTOM:vnd.android.cursor.item/relation\;. I'm assuming these are what's tripping it up.

This should not cause any issues. Worst case would be that the entry would not appear in the nextcloud app. Those are not invalid properties though, just custom ones and they might not be supported by all softwares :)

Is it working on nextcloud now? I see you just closed the issue 🤔

@Lynnesbian
Copy link
Author

I closed it because I assumed that was what was causing the issue, but if not, then it's still an issue. I don't really want to upload the vCard because it contains a lot of private info (as any contact card does), but it definitely appears in the Nextcloud contacts app, and works everywhere else (my phone, Evolution, etc)

@skjnldsv
Copy link
Member

I don't really want to upload the vCard because it contains a lot of private info (as any contact card does)

You can paste it here as text and just change the sensitive data 😉
As long as you don't change any of the properties alongside, it should not matter!

So, just o make sure we're on the same line, you created the issue with the title 'Unable to edit any contacts'. You're talking on the nextcloud app? You can't edit your contacts?
Any of them? :)

@Lynnesbian
Copy link
Author

so i checked again and it turns out that i can edit most contacts, just not some of them. i'll upload an example with sensitive info removed in a moment.

@skjnldsv
Copy link
Member

Awesome! :)
Thanks a lot! I'll re-open this then! 🍵

@skjnldsv skjnldsv reopened this Mar 24, 2019
@Lynnesbian
Copy link
Author

Here's a version of the contact card with sensitive info removed:
blanked.vcf.zip

@skjnldsv
Copy link
Member

@Lynnesbian Thanks!
I cannot reproduce your issue with this contact though. 😕
I will need your browser console log to investigate this issue.
Open your console, reload your page and/or do the action leading to this issue and copy/paste the log in this thread.

How to access your browser console (Click to expand)

Chrome

  • Press either CTRL + SHIFT + J to open the “console” tab of the Developer Tools.
  • Alternative method:
    1. Press either CTRL + SHIFT + I or F12 to open the Developer Tools.
    2. Click the “console” tab.

Safari

  • Press CMD + ALT + I to open the Web Inspector.
  • See Chrome’s step 2. (Chrome and Safari have pretty much identical dev tools.)

IE9

  1. Press F12 to open the developer tools.
  2. Click the “console” tab.

Firefox

  • Press CTRL + SHIFT + K to open the Web console (COMMAND + SHIFT + K on Macs).
  • or, if Firebug is installed (recommended):
    1. Press F12 to open Firebug.
    2. Click on the “console” tab.

Opera

  1. Press CTRL + SHIFT + I to open Dragonfly.
  2. Click on the “console” tab.

@Lynnesbian
Copy link
Author

When I import the blank version it works fine, but when I try the actual version, it doesn't import. There's no error message, and the console logs don't really show anything:

JQMIGRATE: Migrate is installed, version 1.4.0 core.js:7:542
New search handler registered search.js:67:4
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/ core.js:4:14346
Connected to dav! 
Object { rootUrl: Getter & Setter, advertisedFeatures: Getter & Setter, currentUserPrincipal: Getter & Setter, principalCollections: Getter & Setter, calendarHomes: Getter & Setter, addressBookHomes: Getter & Setter, parser: Getter & Setter, _isConnected: Getter & Setter, _request: Getter & Setter, … }
contacts.js:177:32321
Source map error: TypeError: NetworkError when attempting to fetch resource.
Resource URL: https://[removed]/apps/contacts/js/contacts.js?v=73c53709-20
Source Map URL: contacts.js.map[Learn More]
This contact did not have a proper uid. Setting a new one for  
Object { jCal: (3) […], addressbook: {…}, vCard: {…}, conflict: false }
contacts.js:156:516

The Nextcloud logs don't show anything either... this is a difficult one :s

@skjnldsv
Copy link
Member

@Lynnesbian Okay, that is weird.
After import the contact appear in the list?

@Lynnesbian
Copy link
Author

The blank version (attached above) imports fine, the original doesn't import and doesn't show any sort of error message either...

@skjnldsv
Copy link
Member

@Lynnesbian Could you import the broken contact and paste the console log here?
It should output some errors.
Open the console before the import, import the file (and see it fail), and copy the log :)

Thanks!

@caugner
Copy link

caugner commented Apr 5, 2019

I have got the same issue with the following VCard (extracted from the PROPFIND xhr request):

VERSION:4.0
PRODID:+//IDN bitfire.at//DAVdroid/2.0.2-gplay ez-vcard/0.10.4
UID:37ec0347-8586-4b0f-ad45-5ed4746a0a3f
FN:John Doe
N:Doe;John;;;
TEL;TYPE=cell:+49123456789
ADR;TYPE=home;LABEL="Teststr. 63, Berlin":;;Teststr. 63\, Berlin;;;;
REV:20180825T072055Z
END:VCARD

I'm not sure, but the slash in the address could be the cause.

And here is the JavaScript error that I get (I tried to add the contact to a group):

image

@caugner
Copy link

caugner commented Apr 5, 2019

I have debugged a bit and found out that It's actually a bug in ical.js:

Due to the comma in the "Adress" field's label (Teststr. 63, Berlin), the value is converted into an Array (["Teststr. 63", " Berlin"]), but since the label is not a multivalue, the _rfc6868Unescape function is invoked here on the Array (but that function is only defined for string) and causes the TypeError:
https://github.com/mozilla-comm/ical.js/blob/v1.3.0/lib/ical/stringify.js#L127

To be fair, the bug is either in ical.js at this location or somewhere else in ical.js (or possibly in the nextcloud/contacts JS) where the label is erroneously converted into an Array.

Update: Okay, so it's actually a bug in nextcloud/contacts, because it converts the address label into an Array (but I haven't found the code location yet).

Update 2: Actually it is ical.js that returns the parsed vcard with the label converted into an Array here:
https://github.com/nextcloud/contacts/blob/v3.0.5/src/models/contact.js#L52

Minimal proof:

JSON.stringify(ICAL.parse(`BEGIN:VCARD
VERSION:4.0
ADR;TYPE=home;LABEL="Test 42, Berlin":;;Test 42\, Berlin;;;;
END:VCARD
`))

// ["vcard",[["version",{},"text","4.0"],["adr",{"type":"home","label":["Test 42"," Berlin"]},"text",["","",["Test 42"," Berlin"],"","","",""]]],[]]

@caugner
Copy link

caugner commented Apr 7, 2019

@Lynnesbian Can you confirm whether the following line in your vCard also contains a comma in the LABEL (which you replaced with "address removed")?

ADR;TYPE=home;LABEL="address removed":;;1 Example 
 Street\, Removed 12345\, Removed\, Removed;;;;

@Lynnesbian
Copy link
Author

It did contain a comma, yes

@skjnldsv skjnldsv added blocked Waiting for a fix on one of our dependencies and removed needs info Not enough information provided labels Apr 8, 2019
@skjnldsv
Copy link
Member

skjnldsv commented Apr 8, 2019

Thanks both of you for the debug!! 🤗

@caugner
Copy link

caugner commented Apr 8, 2019

@skjnldsv While kewisch/ical.js#386 awaits resolution, a workaround would be to put the LABEL in front of the TYPE:

ADR;LABEL="A, B, C";type=home:;;A, B, C;;;;

@RuralYak
Copy link

RuralYak commented Nov 1, 2019

TO FOLKS AFFECTED BY THIS: Please go to kewisch/ical.js#386 and bump it up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of blocked Waiting for a fix on one of our dependencies bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants