Bug 424183 - Can't view local files: Malformed URL
Summary: Can't view local files: Malformed URL
Status: RESOLVED FIXED
Alias: None
Product: KBibTeX
Classification: Applications
Component: General (other bugs)
Version First Reported In: 0.9.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Thomas Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-14 08:28 UTC by e33v1535
Modified: 2020-07-29 21:54 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 0.10
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description e33v1535 2020-07-14 08:28:00 UTC
SUMMARY
Since some recent update (I can't pinpoint the exact version, sorry), I've been unable to open PDF files directly from KBibTeX (using the "View Document" option). Instead, there is a "Malformed URL" error.

I've double-checked filenames and also tried replacing the local file reference with its full path, to no avail. (Actually, since everything was working fine prior to some recent update, this could not have been the cause anyway, but it never hurts to try...)


STEPS TO REPRODUCE
1. Create new bib entry
2. Add local file reference (e.g., to a PDF)
3. Right-click on entry --> View Document

OBSERVED RESULT
Error:
"Malformed URL
[full path of file]"

EXPECTED RESULT
The document opens.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.19.2
KDE Frameworks Version: 5.71.0
Qt Version: 5.15.0
Comment 1 e33v1535 2020-07-14 08:31:45 UTC
Just updated to KDE 5.19.3 / Frameworks 5.72.0, but the problem persists.
Comment 2 Thomas Fischer 2020-07-16 21:44:14 UTC
I cannot reproduce the problem. KBibTeX does nothing special with the URL, it just passes it to the KDE subsystem (KRun::runUrl) to do something with it.

Can you open the PDF file both using Dolphin and from the command line using 'kde-open5'?
  kde-open5 PDFFILENAMELIKEINKBIBTEX

If either of above fails, it is a strong sign that the problem is not due to KBibTeX.
Comment 3 e33v1535 2020-07-17 07:19:26 UTC
With kde-open5 it works just fine, both with relative and absolute paths.

I also tried creating a fresh .bib file with a single entry and it still produces the same error.
Comment 4 Thomas Fischer 2020-07-17 20:37:27 UTC
(In reply to modanese from comment #3)
> With kde-open5 it works just fine, both with relative and absolute paths.
> 
> I also tried creating a fresh .bib file with a single entry and it still
> produces the same error.
Two things you can try:

1. Create a new account on the same machine, login, and start KBibTeX. Can the issue still be reproduced? If yes, some settings in you home directory are causing the problem.

2. Can you re-create the same problem with a more recent version of KBibTeX? The used function KRun::runUrl has been deprecated in recent KDE Frameworks versions:
https://api.kde.org/frameworks/kio/html/classKRun.html#a73cdb95167576c44fcf19f1ac0d98ecf
Newer KBibTeX versions, such as the upcoming 0.10 have a different code now to open URLs. Can you please try this code to see if the problem still persists?

In case you are wondering how to test the code that will become 0.10, please read here:
https://userbase.kde.org/KBibTeX/Development#Quick_Start_to_Run_KBibTeX_from_Git
The invocation of run-kbibtex.sh would be:
bash run-kbibtex.sh 'https://invent.kde.org/office/kbibtex.git' 'kbibtex/0.10'
Comment 5 e33v1535 2020-07-23 15:11:55 UTC
While testing in a fresh /home directory, I *accidentally* discovered the source of the problem. Namely the URL error appears only if there are *at least 2 or more links* in the bib entry, either to local or external files.

(In my bib file this *always* results in an error because I all my entries have DOI/links/etc. in addition to the PDFs.)

So new steps to reproduce:
1. Create new bib entry
2. Add two or more local file references (e.g., to PDF files)
3. Right-click on entry --> View Document --> Select one of the two entries
Comment 6 e33v1535 2020-07-23 15:22:39 UTC
Also, I tried to download the run-kbibtex.sh script, but the link appears to be dead (cgit.kde.org does not resolve to an IP address).
Comment 7 Thomas Fischer 2020-07-24 17:55:07 UTC
(In reply to modanese from comment #6)
> Also, I tried to download the run-kbibtex.sh script, but the link appears to
> be dead (cgit.kde.org does not resolve to an IP address).
That was an outdated/broken link. I fixed it now, please check and let me know if there are more problems.
Comment 8 e33v1535 2020-07-27 15:38:14 UTC
I can confirm the problem is fixed using the latest git version (commit 75f6a5135...), both with relative and absolute links (or combinations thereof).
Comment 9 Filippo Volpe 2020-07-28 14:18:53 UTC
Just wanted to add that I also experience the issue, so I would exclude it's a fault (or extremely exotic configuration) only for user modanese@kit.edu. Same setup Arch, Kde, and Okular viewer.
Comment 10 Thomas Fischer 2020-07-28 19:40:35 UTC
(In reply to Filippo Volpe from comment #9)
> Just wanted to add that I also experience the issue, so I would exclude it's
> a fault (or extremely exotic configuration) only for user modanese@kit.edu.
> Same setup Arch, Kde, and Okular viewer.

Good to know that two users independently can confirm the issue as I have problems to reproduce it.

Filippo: can you please confirm that the latest Git version fixes the problem?
Fetch 'run-kbibtex.sh' as explained earlier, then run:
bash run-kbibtex.sh 'https://invent.kde.org/office/kbibtex.git' 'master'

Both Filippo and modanese: please check if the code for the upcoming release of 0.10 also contains the fix. You can test the code by running:
bash run-kbibtex.sh 'https://invent.kde.org/office/kbibtex.git' 'kbibtex/0.10'
Comment 11 e33v1535 2020-07-29 07:23:36 UTC
0.10 also works for me.
Comment 12 Filippo Volpe 2020-07-29 08:55:13 UTC
Confirm that both master and 0.10 works for me.
Comment 13 Thomas Fischer 2020-07-29 21:54:32 UTC
(In reply to modanese from comment #11)
> 0.10 also works for me.

(In reply to Filippo Volpe from comment #12)
> Confirm that both master and 0.10 works for me.

Ok, I take it as a given that the problem is fixed and resolved as of the hopefully soon-to-be-released version 0.10.

Thank you for your quick feedback!