• Hi there. I have setup a WebDAV share to my personal SabreDAV server. If i use for example andOTP, i can create my backups directly on the given share. However, when i try to open a file from the share, all the files are greyed out. They are listed, i can see them, but i cant select the files. I can click and open folders and subfolders. If i copy such a file with an other filemanger from the share to the local device, i can select them.

    What im doing wrong?

  • developer

    @offerel Hi,

    DAVx5 gets the MIME type from the server, and the MIME type determines which apps you can use to open the files. If the server sends another MIME type (and they often do), you won’t be able to open the file with the correct app (Android doesn’t know which file type it is).

    Can you try to copy the files to the local storage and then open it?


  • @rfc2822 Yes thats working. I will try to fiddle with the mime type response from SabreDAV tomorrow. Maybe i find a solution at the server.


  • @rfc2822 In a quick test, i added the GuessContentType addon to my server config. Now I can select the files properly. Many thx for the suggestion. Problem solved.

    https://sabre.io/dav/guesscontenttype/

  • developer

    @offerel Good to hear. Didn’t know GuessContentType 🙂


  • @rfc2822 Sorry but I must come back to the topic. The plugin sounded familiar to me. In fact, I came across a request from 2018 (https://github.com/sabre-io/dav/issues/1061). But I found a workaround today. I integrate the plugin as follows in my site:

    $cType = new \Sabre\DAV\Browser\GuessContentType();
    $cType->extensionMap = [
    	// images
        'jpg' => 'image/jpeg',
        'gif' => 'image/gif',
        'png' => 'image/png',
    
        // groupware
        'ics' => 'text/calendar',
        // 'vcf' => 'text/vcard', // removed as of https://github.com/sabre-io/dav/issues/1061
    	
    	// text
        'txt' => 'text/plain',
        
        // borrowed from https://github.com/cymen/ApacheMimeTypesToDotNet/blob/master/ApacheMimeTypes.cs
        'gz' => 'application/x-gzip',
    	'pdf' => 'application/pdf',
    	'tgz' => 'application/x-compressed',
    	'tar' => 'application/x-tar',
    	'xml' => 'text/xml',
    	'zip' => 'application/x-zip-compressed',
    	'7z' =>	'application/x-7z-compressed',
    	'apk' => 'application/vnd.android.package-archive',
    	'bz2' => 'application/x-bzip2',
    	'csv' => 'text/csv',
    	'davmount' => 'application/davmount+xml',
    	'deb' => 'application/x-debian-package',
    	'eml' => 'message/rfc822',
    	'epub' => 'application/epub+zip',
    	'kml' => 'application/vnd.google-earth.kml+xml',
    	'kmz' => 'application/vnd.google-earth.kmz',
    	'mobi' => 'application/x-mobipocket-ebook',
    	'md' => 'text/markdown',	
    	'odb' => 'application/vnd.oasis.opendocument.database',
    	'odc' => 'application/vnd.oasis.opendocument.chart',
    	'odf' => 'application/vnd.oasis.opendocument.formula',
    	'odg' => 'application/vnd.oasis.opendocument.graphics',
    	'odi' => 'application/vnd.oasis.opendocument.image',
    	'odm' => 'application/vnd.oasis.opendocument.text-master',
    	'odp' => 'application/vnd.oasis.opendocument.presentation',
    	'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
    	'odt' => 'application/vnd.oasis.opendocument.text',
    	'p10' => 'application/pkcs10',
    	'p12' => 'application/x-pkcs12',
    	'pfx' => 'application/x-pkcs12',
    	'p7c' => 'application/pkcs7-mime',
    	'p7m' => 'application/pkcs7-mime',
    	'p7r' => 'application/x-pkcs7-certreqresp',
    	'p7s' => 'application/pkcs7-signature',
    	'p8' => 'application/pkcs8',
    	'pdf' => 'application/pdf',
    	'pgp' => 'application/pgp-encrypted',
    	'rdf' => 'application/rdf+xml',
    	'svg' => 'image/svg+xml',
    ];
    $server->addPlugin($cType);
    

    This looks at first glance more bulky than in the SabreDAV example itself but so I can overwrite the predefined MimeType and enhance it with my own. I have commented the problematic vcf format. For CarDAV this does not bring any change. Alternatively, you can set application/octet-stream at this point safely.

    So if anyone runs into the same problem, this may be helpful. Works great like this on my Raspberry PI running Debian Bullseye with Nginx/PHP7-4-fpm.

  • developer

    @offerel said in WebDAV files greyed out:

    For CarDAV this does not bring any change.

    Just make sure that the vCard is sent as text/vcard; otherwise it could break CardDAV. In the next DAVx^5 version, we aim to support jCard, so the MIME type reported by the server will be evaluated (at the moment, DAVx^5 just assumes that it’s really a vCard). We will fall back to assume its a vCard when it’s not a jCard, but the Content-Type returned by the server should nevertheless always be correct, and a CardDAV server should return text/vcard for vCard or application/vcard+json for jCard.


  • @rfc2822 yes. The change above should only impact the webdav/files part, but not the cardav server. The plugin is part of the browser package.

    At least this is what I have understand how sabredav is constructed.

    I feared that the whole sabredav project would be dead after evert leaved the project, but I’m happy that this isn’t the case.

Similar topics

  • 2
  • 4
  • 4