Bug 289083 - Using WebDAV open dialog does not detect the mimetype and not open the default program
Summary: Using WebDAV open dialog does not detect the mimetype and not open the defaul...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: WebDAV (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 299914 324153 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-12-15 22:59 UTC by Alejandro Moreno Calvo
Modified: 2019-10-03 15:48 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.8.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alejandro Moreno Calvo 2011-12-15 22:59:11 UTC
Version:           1.7 (using KDE 4.7.2) 
OS:                Linux

When you try to open a file in a webdav folder, dolphin shows "Open with" dialog instead of open file with the default program.

Reproducible: Always

Steps to Reproduce:
1. Open dolphin an go to webdav folder.
2. Open a file

Actual Results:  
Show "Open with" dialog

Expected Results:  
Open a program
Comment 1 Dawit Alemayehu 2011-12-26 02:08:24 UTC
This should be fixed for the upcoming KDE 4.8.0 release. See
https://projects.kde.org/projects/kde/kdelibs/repository/revisions/0b810d76
Comment 2 Alejandro Moreno Calvo 2011-12-29 00:17:14 UTC
This error continues under version 4.8 RC1 (4.7.95).
Comment 3 Dawit Alemayehu 2011-12-29 00:26:33 UTC
(In reply to comment #2)
> This error continues under version 4.8 RC1 (4.7.95).

What type of file are you trying to open ? A text file, a PDF ? Can you provide the address to the webdav server where you see this issue ?
Comment 4 Alejandro Moreno Calvo 2011-12-29 10:02:28 UTC
The server is webdavs://cjcitycentro.org:2078/ I can try give you access.
I have tried to open a txt file and a tar.gz and neither has worked for me.
Comment 5 Dawit Alemayehu 2011-12-29 16:23:03 UTC
(In reply to comment #4)
> The server is webdavs://cjcitycentro.org:2078/ I can try give you access.
> I have tried to open a txt file and a tar.gz and neither has worked for me.

Please send me the access information to the personal email you see in this bug report.
Comment 6 Dawit Alemayehu 2011-12-30 00:00:29 UTC
You webdav server, which I assume is apache with mod_dav, returns "httpd/unix-file" as the content type for each file. Hence, this issue. You need to enable the ability for mod_dav to correctly set the content-type for each file type. 

I even tried to workaround this by ignoring the mime-type it sends when it is "httpd/unix-file", but unfortunately that only helps with the proper icon being displayed when it is listed. The minute you attempt to retrieve the file, your sever returns another bogus mime-type "application/download". Hence, this is not something we can workaround. You need to fix your server.
Comment 7 Dawit Alemayehu 2011-12-30 00:09:57 UTC
Just a guess... You probably do not have mod_mime[1] enabled in your apache server ?


[1] http://httpd.apache.org/docs/2.2/mod/mod_mime.html
Comment 8 Alejandro Moreno Calvo 2011-12-30 10:33:28 UTC
The server is a shared hosting with http://www.redcoruna.com
I will try to contact them to solve it but the same problem can occur with other shared servers.

Will this be a bug of Apache that should send "application/octet-stream" instead of "application/download"?
Comment 9 Dawit Alemayehu 2011-12-30 16:41:35 UTC
(In reply to comment #8)
> The server is a shared hosting with http://www.redcoruna.com
> I will try to contact them to solve it but the same problem can occur with
> other shared servers.
> 
> Will this be a bug of Apache that should send "application/octet-stream"
> instead of "application/download"?

Yes, but it does not seem to me to be a bug. It is rather a misconfiguration of Apache. Your apache installation does not seem have "mod_mime" installed. Hence, it is sending whatever default values it has built-in. For web dav that would be "httpd/unix-file" or "httpd/unix-directory" based on what you are doing.

And yes it should at minimum return the default mime-type ("application/octet-stream") instead of a bogus "application/download" mimetype. All of that points to a server misconfiguration...
Comment 10 Alejandro Moreno Calvo 2012-01-02 15:37:38 UTC
I has spoken with me hosting and it has said that mod_mime is installed.
Maybe the problem can be CPanel that is the tool used to make the webdav directories.
Comment 11 Dawit Alemayehu 2013-08-28 12:50:51 UTC
*** Bug 324153 has been marked as a duplicate of this bug. ***
Comment 12 Axel Braun 2013-12-22 07:42:47 UTC
This bug is still in 4.11.3 using the webdav of 1&1 webdavs://webdav.office.1und1.de
Following comment #7, is there a way I can check for the apache extention from external?
Comment 13 Axel Braun 2014-03-15 17:52:47 UTC
Problem still exists in 4.12.3
Comment 14 Axel Braun 2014-03-18 11:25:13 UTC
I checked this with a different webdavs-server (mediacenter.gmx.net), same behaviour.
mimetypes work for sftp connections.

This bug is IMHO not only important, it is as well getting urgent, as more people are about to work with webdavs / cloud solutions. I'm about to kick out the Windows-PC in a company, but this stops me at the moment...Any chance that we get a solution soon?
Comment 15 Dawit Alemayehu 2014-03-19 05:17:35 UTC
(In reply to comment #14)
> I checked this with a different webdavs-server (mediacenter.gmx.net), same
> behaviour.
> mimetypes work for sftp connections.
> 
> This bug is IMHO not only important, it is as well getting urgent, as more
> people are about to work with webdavs / cloud solutions. I'm about to kick
> out the Windows-PC in a company, but this stops me at the moment...Any
> chance that we get a solution soon?

There is nothing we can do about the server sending incorrect content type information. For example, the test webdav servers you find at http://boonfaya.com/sites/webdavapps.com/#targets all return incorrect content type (text/plain) for any content:

io_http(4854)/kio_http_debug HTTPProtocol::readBody: "1978" bytes left.
kio_http(4854)/kio_http_debug HTTPProtocol::readBody: EOD received! Left = "0"
kio_http(4854)/kio_http_debug HTTPProtocol::cacheFileClose:
kio_http(4854)/kio_http_debug HTTPProtocol::davParsePropstats: Got status code 404 (this may mean that some properties are unavailable)
kio_http(4854)/kio_http_debug updateUDSEntryMimeType: item: "." , mimeType: ""
kio_http(4854)/kio_http_debug HTTPProtocol::davParsePropstats: Got status code 404 (this may mean that some properties are unavailable)
kio_http(4854)/kio_http_debug updateUDSEntryMimeType: item: "Demo Image - Northern Lights.jpg" , mimeType: "text/plain"

Notice how it returned text/plain for a JPEG file. On the other hand the owncloud test webdav server at webdav://demo.owncloud.org/remote.php/webdav/ returns the correct content type:

kio_http(5469)/kio_http_debug updateUDSEntryMimeType: item: "Demo Image - Northern Lights.jpg" , mimeType: "image/jpeg"
kio_http(5469)/kio_http_debug HTTPProtocol::davParsePropstats: Got status code 404 (this may mean that some properties are unavailable)
kio_http(5469)/kio_http_debug updateUDSEntryMimeType: item: "Demo Movie OGG - Big Bug Bunny Trailer.ogg" , mimeType: "audio/ogg"
kio_http(5469)/kio_http_debug HTTPProtocol::davParsePropstats: Got status code 404 (this may mean that some properties are unavailable)
kio_http(5469)/kio_http_debug updateUDSEntryMimeType: item: "Demo MP3 - E.J. - Blick Zurück.mp3" , mimeType: "audio/mpeg"
kio_http(5469)/kio_http_debug HTTPProtocol::davParsePropstats: Got status code 404 (this may mean that some properties are unavailable)
kio_http(5469)/kio_http_debug updateUDSEntryMimeType: item: "Demo PDF - Alice in Wonderland.pdf" , mimeType: "application/pdf"
kio_http(5469)/kio_http_debug HTTPProtocol::davParsePropstats: Got status code 404 (this may mean that some properties are unavailable)
kio_http(5469)/kio_http_debug updateUDSEntryMimeType: item: "Demo Presentation - Bored.impress" , mimeType: "text/impress"
kio_http(5469)/kio_http_debug HTTPProtocol::davParsePropstats: Got status code 404 (this may mean that some properties are unavailable)
kio_http(5469)/kio_http_debug updateUDSEntryMimeType: item: "Demo Textfile - License.txt" , mimeType: "text/plain"
kio_http(5469)/kio_http_debug HTTPProtocol::davParsePropstats: Got status code 404 (this may mean that some properties are unavailable)
kio_http(5469)/kio_http_debug updateUDSEntryMimeType: item: "New Document.odt" , mimeType: "application/vnd.oasis.opendocument.text"

I am almost certain the webdav servers you are testing against return bogus content type information like the first example I provided. I dunno what we can do about that since we always rely on the server to tell us the content type.
Comment 16 Axel Braun 2014-03-19 07:45:44 UTC
(In reply to comment #15)

> I am almost certain the webdav servers you are testing against return bogus
> content type information like the first example I provided. I dunno what we
> can do about that since we always rely on the server to tell us the content
> type.

Thanks for your verbose analysis. To get the large companies to fix their servers will be almost impossible unless you have some media echo around it.
Alternative would be to work around it it and at least look for the file extention to guess the right application.
Anyway, I would like to debug the two servers I work with. I you could provide me some information on how to do that ...I'm more a user than a programmer (at least in the KDE context). 
Thanks in advance!
Comment 17 Dawit Alemayehu 2014-09-27 15:27:12 UTC
*** Bug 299914 has been marked as a duplicate of this bug. ***
Comment 18 Alejandro Moreno Calvo 2016-06-16 20:28:41 UTC
Definitely there was a problem with webdav configurate using CPanel. You can see more info in https://forums.cpanel.net/threads/case-104037-webdavs-server-webdisk-sending-wrong-mime-type.410812/

I don't know if in recent versions of CPanel the bug was corrected but i think that we can close this bug.

I have seen that some webdav servers seen mimetype 'httpd/unix-file' when they can not obtain the correct mimetype (Example https://rt.cpan.org/Public/Bug/Display.html?id=60883 ) I don't know if in this case a workaround to ignore this default mimetype could be sense.