[okular] [Bug 378449] Fall back to PDF when file type cannot be inferred from extension or MIME type

2018-10-01 Thread Christoph Feck
https://bugs.kde.org/show_bug.cgi?id=378449

--- Comment #21 from Christoph Feck  ---
This probably depends on the (local) contents of the MIME database. Please
check what 'kmimetypefinder5' says when passing the file. On my system, it is
unaware of 'application/x-wine-extension-aspx' and outputs 'application/pdf'
when passing a PDF file named '.aspx'. Maybe 'wine' package adds entries to the
MIME database.

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 378449] Fall back to PDF when file type cannot be inferred from extension or MIME type

2018-10-01 Thread Albert Astals Cid
https://bugs.kde.org/show_bug.cgi?id=378449

--- Comment #20 from Albert Astals Cid  ---
(In reply to Damian Kaczmarek from comment #19)
> Albert - actually I am failing to see how 'fall back to pdf when the file
> type cannot be inferred" makes no sense'. To me the "makes no sense part" is
> not obvious - could you elaborate please? Especially because it kind of
> works already.

Okular is not a pdf viewer, so why would it fall back to pdf instead of djvu or
ps or xps or any of the multiple document types we support?

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 378449] Fall back to PDF when file type cannot be inferred from extension or MIME type

2018-10-01 Thread Damian Kaczmarek
https://bugs.kde.org/show_bug.cgi?id=378449

--- Comment #19 from Damian Kaczmarek  ---
Albert - actually I am failing to see how 'fall back to pdf when the file type
cannot be inferred" makes no sense'. To me the "makes no sense part" is not
obvious - could you elaborate please? Especially because it kind of works
already.

> cp foo.pdf foo && okular foo # THIS WORKS
v> cp foo.pdf foo.mp9 && okular foo.mp9 # THIS WORKS
> cp foo.pdf foo.mp3 && okular foo.mp3 # THIS FAILS

>From just a functional point of view it makes a lot of sense to me in the
instance of some browsers/websites/applications generating PDF files with a
wrong extension. This saves the user one extra step but perhaps I missed some
disadvantages of this approach.

Just my 2 cents, Cheers.

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 378449] Fall back to PDF when file type cannot be inferred from extension or MIME type

2018-10-01 Thread Albert Astals Cid
https://bugs.kde.org/show_bug.cgi?id=378449

Albert Astals Cid  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |NOT A BUG

--- Comment #18 from Albert Astals Cid  ---
(In reply to Jonathan Verner from comment #17)
> (In reply to Albert Astals Cid from comment #16)
> 
> > Pointing to lines of code is bad, he pretends like he understands the code,
> > which he doesn't, so it makes him less credible. 
> 
> I know some user comments may be frustrating, but IMHO a reply implying bad
> faith ("pretends") and lack of skill ("he doesn't understand code") does
> more damage than good and goes against the KDE code of conduct. 

Don't bring the code of conduct here, that's silly.

> I'd suggest
> you ignore the bug if the user comments brush you the wrong way and you
> can't reply in a positive way (which is HARD, I admit).

No, because the user then may then go on saying "see they're shit as i said",
so if the user is ignoring my questions and comments i will call him on it.

> As far as the bug goes, I can now reproduce it. The problem seems to be that
> okular only looks at the contents when the etension either is not registered
> in the system mimetype database at all or it is registered to a mimetype
> which Okular has a plugin for. If it is and the extension does not
> correspond to the file contents, okular fails opening the file:
> 
>   $ okular test.pdf
>   $ mv test.pdf test.ods
>   $ okular test.ods
>   $ mv test.ods test.non_registered_ext
>   $ okular test.non_registered_ext
>   $ mv test.non_registered_ext test.txt
>   $ okular test.txt
> 
> Only the third line fails for me (because ods is registered as an extension
> of mime type 'application/vnd.oasis.opendocument.spreadsheet' on my system
> and okular has no plugin for it)
> 
> > provide a patch that fixes the issue for him, he should stop pointing to the
> > code and start trying to help us reproduce the issue.
> 
> Actually, pointing to the code made it easier for me to go over it (I
> wouldn't bother without the link). It seems there really is a bug there:
> 
> https://github.com/KDE/okular/blob/21836ba072b2d4189f1257af06c11f134f2edc31/
> core/document.cpp#L2417
> 
> should use the 'QMimeDatabase::MatchContent' mode instead of
> 'QMimeDatabase::MatchExtension'.

Yes, that is correct, whoever ported that code make a mistake. I'll fix it.
*BUT* I'm still going to close this (NOT A BUG because i can't find a better
option), since we're not going to "fall back to pdf when the file type cannot
be inferred" since it makes no sense.

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 378449] Fall back to PDF when file type cannot be inferred from extension or MIME type

2018-09-30 Thread Jonathan Verner
https://bugs.kde.org/show_bug.cgi?id=378449

Jonathan Verner  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Ever confirmed|0   |1
 Resolution|NOT A BUG   |---

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 378449] Fall back to PDF when file type cannot be inferred from extension or MIME type

2018-09-30 Thread Jonathan Verner
https://bugs.kde.org/show_bug.cgi?id=378449

--- Comment #17 from Jonathan Verner  ---
(In reply to Albert Astals Cid from comment #16)

> Pointing to lines of code is bad, he pretends like he understands the code,
> which he doesn't, so it makes him less credible. 

I know some user comments may be frustrating, but IMHO a reply implying bad
faith ("pretends") and lack of skill ("he doesn't understand code") does more
damage than good and goes against the KDE code of conduct. I'd suggest you
ignore the bug if the user comments brush you the wrong way and you can't reply
in a positive way (which is HARD, I admit).

As far as the bug goes, I can now reproduce it. The problem seems to be that
okular only looks at the contents when the etension either is not registered in
the system mimetype database at all or it is registered to a mimetype which
Okular has a plugin for. If it is and the extension does not correspond to the
file contents, okular fails opening the file:

  $ okular test.pdf
  $ mv test.pdf test.ods
  $ okular test.ods
  $ mv test.ods test.non_registered_ext
  $ okular test.non_registered_ext
  $ mv test.non_registered_ext test.txt
  $ okular test.txt

Only the third line fails for me (because ods is registered as an extension of
mime type 'application/vnd.oasis.opendocument.spreadsheet' on my system and
okular has no plugin for it)

> provide a patch that fixes the issue for him, he should stop pointing to the
> code and start trying to help us reproduce the issue.

Actually, pointing to the code made it easier for me to go over it (I wouldn't
bother without the link). It seems there really is a bug there:

https://github.com/KDE/okular/blob/21836ba072b2d4189f1257af06c11f134f2edc31/core/document.cpp#L2417

should use the 'QMimeDatabase::MatchContent' mode instead of
'QMimeDatabase::MatchExtension'.

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 378449] Fall back to PDF when file type cannot be inferred from extension or MIME type

2018-09-29 Thread Albert Astals Cid
https://bugs.kde.org/show_bug.cgi?id=378449

--- Comment #16 from Albert Astals Cid  ---
(In reply to Damian Kaczmarek from comment #15)
> Well, I wonder what would be the right behavior from the UX point of view? I
> personally would like Okular to do its best to open the files I throw at it. 

And it does, it tries like 3 different ways of opening the file before it bails
out.

> As for the above conversation, it seems it has gone personal. Guys ... no
> need to go there. It looks like Nowak provided steps to produce in the
> message from 2017-04-13 23:33:39 UTC

Have you read my answers? His steps *do not work*

> Even if bug cannot be reproduced (yet) clearly it's happening to at least
> one user who as it appears is open to providing more data, links to the code.

Pointing to lines of code is bad, he pretends like he understands the code,
which he doesn't, so it makes him less credible. So unless he can actually
provide a patch that fixes the issue for him, he should stop pointing to the
code and start trying to help us reproduce the issue.

But anyway we'll never fall back to PDF because it makes no sense.

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 378449] Fall back to PDF when file type cannot be inferred from extension or MIME type

2018-09-28 Thread Damian Kaczmarek
https://bugs.kde.org/show_bug.cgi?id=378449

Damian Kaczmarek  changed:

   What|Removed |Added

 CC||rus...@gmail.com

--- Comment #15 from Damian Kaczmarek  ---
Well, I wonder what would be the right behavior from the UX point of view? I
personally would like Okular to do its best to open the files I throw at it. 

As for the above conversation, it seems it has gone personal. Guys ... no need
to go there. It looks like Nowak provided steps to produce in the message from
2017-04-13 23:33:39 UTC

Even if bug cannot be reproduced (yet) clearly it's happening to at least one
user who as it appears is open to providing more data, links to the code.

I suggest to re-open for future investigation and perhaps re-purpose. Let the
other users find this issue ..

PS.
https://community.kde.org/Get_Involved/Bug_Reporting
> Have a thick skin
> Sometimes your bug report will get closed without the resolution you're 
> hoping for. This feels disappointing, but it's not personal. The project is 
> larger than any one of us.

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 378449] Fall back to PDF when file type cannot be inferred from extension or MIME type

2018-09-28 Thread Albert Astals Cid
https://bugs.kde.org/show_bug.cgi?id=378449

Albert Astals Cid  changed:

   What|Removed |Added

 Status|REPORTED|RESOLVED
 Resolution|--- |NOT A BUG

--- Comment #14 from Albert Astals Cid  ---
You must be very smart, congratulations.

We won't fail back to PDF just because you think it's a good idea.

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 378449] Fall back to PDF when file type cannot be inferred from extension or MIME type

2018-09-28 Thread Damian Nowak
https://bugs.kde.org/show_bug.cgi?id=378449

Damian Nowak  changed:

   What|Removed |Added

Summary|Fall back to PDF when file  |Fall back to PDF when file
   |type cannot be inferred |type cannot be inferred
   |from extension  |from extension or MIME type

--- Comment #13 from Damian Nowak  ---
Talking SOA#1 instead of talking source code won't get you anywhere.

The summary of this bug/feature request is:

> Fall back to PDF when file type cannot be inferred from extension (or mime 
> type)

Thank you for considering this feature.

-- 
You are receiving this mail because:
You are watching all bug changes.