Resource file name being an encoded URL causes this URL to be accessed



  • in my case the uid of a contact contains old remains of former carddav servers i used (davical). the UID of my contact contains the url of that servers. davdroid somehow parses that url for some reason and fails sync (maybe because that servers dont exist anymore). here is the log:

    I/davdroid.DavSyncAdapter(21906): Performing sync for authority com.android.contacts
    D/davdroid.DavSyncAdapter(21906): Creating new DavHttpClient
    I/davdroid.DavHttpClient(21906): Wire logging active, disabling HTTP compression
    D/davdroid.DavSyncAdapter(21906): Server supports VCard version 3.0
    V/davdroid.URIUtils(21906): Normalized URL https://oc.metaccount.de/remote.php/carddav/addressbooks/smoe/contacts/ -> https://oc.metaccount.de/remote.php/carddav/addressbooks/smoe/contacts/
    D/davdroid.WebDavResource(21906): Using preemptive authentication (not compatible with Digest auth)
    I/davdroid.SyncManager(21906): Remotely removing 0 deleted resource(s) (if not changed)
    I/davdroid.SyncManager(21906): Uploading 0 new resource(s) (if not existing)
    I/davdroid.SyncManager(21906): Uploading 2 modified resource(s) (if not changed)
    D/davdroid.LocalAddressBook(21906): Populating group from sourceid=? AND deleted=0 Familie
    V/davdroid.URIUtils(21906): Normalized URL https%3A%2F%2Fsmoe%2540geruechtekueche.de%40cal.geruechtekueche.de%2Fsmoe%2540geruechtekueche.de%2Fadressen%2F592DA267-54FD6CDF-35723803.vcf.vcf -> https://smoe%2540geruechtekueche.de@cal.geruechtekueche.de/smoe%2540geruechtekueche.de/adressen/592DA267-54FD6CDF-35723803.vcf.vcf
    W/davdroid.Contact(21906): Created potentially invalid VCard! [Email] | W09: TYPE parameter value ("home") is not supported by this property in this vCard version.
    D/HttpClient(21906): Connection request: [route: HttpRoute[{s}->https://cal.geruechtekueche.de:443]][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 3]
    D/HttpClient(21906): Connection leased: [id: 2][route: HttpRoute[{s}->https://cal.geruechtekueche.de:443]][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 3]
    D/HttpClient(21906): Opening connection HttpRoute[{s}->https://cal.geruechtekueche.de:443]
    D/HttpClient(21906): http-outgoing-2: Shutdown connection
    D/HttpClient(21906): Connection discarded
    D/HttpClient(21906): http-outgoing-2: Close connection
    D/HttpClient(21906): Connection released: [id: 2][route: HttpRoute[{s}->https://cal.geruechtekueche.de:443]][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 3]
    E/davdroid.DavSyncAdapter(21906): I/O error (Android will try again later)
    I/davdroid.DavSyncAdapter(21906): Sync complete for com.android.contacts
    D/davdroid.DavSyncAdapter(21906): Closing httpClient
    D/HttpClient(21906): Connection manager is shutting down
    D/HttpClient(21906): Connection manager shut down
    E/ExternalAccountType(10394): Unsupported attribute readOnly
    

    the correct carddav server url is https://oc.metaccount.de/remote.php/carddav which is an owncloud 8 service.

    the old one (davical) is https://cal.geruechtekueche.de:443 which only appears in the UID field of most of my contacts (since i imported them from davical). the UID looks like this:

    UID:https://smoe@oc.metaccount.de/remote.php/carddav/addressbooks/smoe/cont
     acts/https%253A%252F%252Fsmoe%252540geruechtekueche.de%2540cal.geruechteku
     eche.de%252Fsmoe%252540geruechtekueche.de%252Fadressen%252F592DA267-54FD6C
     DF-35723803.vcf.vcf
    

  • developer

    Thanks for your report.

    Is this a DAVdroid/ez-vcard issue or is the UID invalid? Did you try with other UIDs?



  • i do not understand. what do you mean by "DAVdroid/ez-vcard"? what would be an invalid UID? i didnt try with other UIDs since the sync process takes the whole addressbook with over 100 cards in it. unfortunately sync stops with the described issue, so i dont know how to try a different UID here.

    can you explain why davdroid is using the url from the UID?


  • developer

    can you explain why davdroid is using the url from the UID?

    Ok, now I understand your problem. DAVdroid should never use the URL from your UID and I can't imagine that it does. So you do only have a DAVdroid account on your device that you have setup with https://oc.metaccount.de/remote.php/carddav as URL?



  • exactly. i searched all my contacts for appearance of the invalid URL and the only approach was in the UIDs in the very same way the log lets suggest:

    ...
    V/davdroid.URIUtils(21906): Normalized URL https%3A%2F%2Fsmoe%2540geruechtekueche.de%40cal.geruechtekueche.de%2Fsmoe%2540geruechtekueche.de%2Fadressen%2F592DA267-54FD6CDF-35723803.vcf.vcf -> https://smoe%2540geruechtekueche.de@cal.geruechtekueche.de/smoe%2540geruechtekueche.de/adressen/592DA267-54FD6CDF-35723803.vcf.vcf
    ....
    

  • developer

    Oh, I see. It's not related to the UID, but the file name.

    The file name contains https%3A…, which has been normalized to https://… and was then taken as a relative path instead of an absolute one.

    As a workaround, you can of course change the file name so that it doesn't contain an encoded URL.


  • developer

    Can you please provide full logs, i.e. with log.tag.Wire and log.tag.HttpClient set to VERBOSE so that I can reproduce the issue?



  • the logs in my initial post are collected by following the howto you provided. including the VERBOSE settings.
    What do you mean by Resource file name being an encoded URL? What is the Resource file name? I certainly hope you mean the UID.


  • developer

    the logs in my initial post are collected by following the howto you provided. including the VERBOSE settings.

    Assuming that you use a recent DAVdroid version – did you setprop log.tag.Wire VERBOSE and setprop log.tag.HttpClient VERBOSE in the adb shell? If you do, the whole network traffic will be logged which will be helpful in debugging this issue.

    What do you mean by Resource file name being an encoded URL? What is the Resource file name? I certainly hope you mean the UID.

    No, the resourcename is the file name where the VCard is stored (file name in the URL, of course it may be a database entry too). A VCard may be stored in your.collection/my.file.name.vcf and still have an UID of 12345. Often, the filename is UID.vcf, but that's not a requirement.

    In your case, the file name is https%3A%2F%2Fsmoe%2540geruechtekueche.de%40cal.geruechtekueche.de%2Fsmoe%2540geruechtekueche.de%2Fadressen%2F592DA267-54FD6CDF-35723803.vcf.vcf, but the UID may be something other (I can't see the UID without verbose logs).


  • developer

    @smoebody Can you please write to play@bitfire.at so that we can send a new APK for testing?



  • I was having the same issue and the commit appears to have fixed it for me.


Log in to reply
 

Looks like your connection to Bitfire App Forums was lost, please wait while we try to reconnect.