URLs with file schema do not work

Bug #1584470 reported by leastcommonancestor on 2016-05-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

URLs with file schema for links to local files and directories (e.g. file:///<local path>) do not work, neither if the link is part of the "Comments" field, nor if the link is generated by a rule to convert an identifier to a link.

Calibre version: 2.57
OS: Ubuntu 15.10

I cannot reproduce this, on my linux system. Steps I tried:

1) Click Edit metadata
2) Click the insert link button
3) Click the browse for file on your computer button
4) Choose a file
5) Click OK
6) The resulting link in the Book Details panel opens the previously selected file.

Remember that for a file to be opened when you click it, you need to
have a non-broken implementation of xdg-open on your system

 status invalid

Changed in calibre:
status: New → Invalid

Sorry, my bad. I expected the action to be opening a browser tab.
Instead the action was to open a file manager window, which I did not
notice, since the file manager already showed the expected directory.
However, I found another (presumed) bug: If the file path contains
special characters (e.g. Umlaut-ö) and I enter such an identifier via
"Edit Metadata" (e.g. adding "extern:Lexika/Bibliographie der
österreichischen Zeitschriften 1704-1850/"), after clicking "Ok" I get
an exception:

calibre, version 2.57.0
ERROR: Unhandled exception: <b>KeyError</b>:u'\xf6'

calibre 2.57 embedded-python: True is64bit: False
Linux-4.2.0-36-generic-i686-with-debian-jessie-sid Linux ('32bit', 'ELF')
('Linux', '4.2.0-36-generic', '#42-Ubuntu SMP Thu May 12 22:03:27 UTC 2016')
Python 2.7.9
Linux: ('debian', 'jessie/sid', '')
Successfully initialized third party plugins: DeDRM
Traceback (most recent call last):
  File "site-packages/calibre/gui2/book_details.py", line 722, in show_data
  File "site-packages/calibre/gui2/book_details.py", line 488, in show_data
  File "site-packages/calibre/gui2/book_details.py", line 30, in render_html
  File "site-packages/calibre/gui2/book_details.py", line 105, in
render_data
  File "site-packages/calibre/ebooks/metadata/book/render.py", line 151,
in mi_to_html
  File "site-packages/calibre/ebooks/metadata/sources/identify.py", line
533, in urls_from_identifiers
  File "urllib.py", line 1294, in quote
KeyError: u'\xf6'

The same exception is produced later every time, when I select the
corresponding book.

If I change the identifier to URL-encode the offending character (e.g.
"ö" → "%C3%B6"), the link does not work and there is no error indication.
The same happens, if there is an error in the path (e.g
"extern:Lexika/Bibliographie der sterreichischen Zeitschriften
FOOBAR/"). There should be some error indication. I would prefer, if all
URLs would be opened in a browser tab, because then the path and a "File
not found" error message would be shown in the browser tab.

Thank you for your quick response.

Greetings from Munich

LCA

On 22.05.2016 16:21, Kovid Goyal wrote:
> I cannot reproduce this, on my linux system. Steps I tried:
>
> 1) Click Edit metadata
> 2) Click the insert link button
> 3) Click the browse for file on your computer button
> 4) Choose a file
> 5) Click OK
> 6) The resulting link in the Book Details panel opens the previously selected file.
>
> Remember that for a file to be opened when you click it, you need to
> have a non-broken implementation of xdg-open on your system
>
> status invalid
>
> ** Changed in: calibre
> Status: New => Invalid
>

Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: Invalid → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers