Bug 435552 - When passing .kmy file as an argument, do not pass it further to WebConnect
Summary: When passing .kmy file as an argument, do not pass it further to WebConnect
Status: CONFIRMED
Alias: None
Product: kmymoney
Classification: Applications
Component: importer (show other bugs)
Version: 5.1.1
Platform: Other Other
: NOR major
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-09 17:25 UTC by Dawid Wróbel
Modified: 2021-04-10 14:14 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dawid Wróbel 2021-04-09 17:25:07 UTC
SUMMARY
If .kmy file is passed as an argument to kmymoney executable, the file is opened *and* still passed to WebConnect. 


STEPS TO REPRODUCE
1. Pass .kmy file as an argument
2. notice that the file is passed to KMyMoneyApp::webConnect()


OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Thomas Baumgart 2021-04-10 10:45:03 UTC
It's not only .kmy but could also be .xml.  In fact, using .xml as argument to KMyMoney does not open the .xml file but opens the most recent used file and then tries to import the .xml as CSV. The plugin detection introduced with commit 403529b3 is broken :(
Comment 2 Thomas Baumgart 2021-04-10 11:00:58 UTC
The following change in "bool CSVImporter::isMyFormat(const QString& filename) const" breaks it:

-    return filename.endsWith(QLatin1String(".csv"), Qt::CaseInsensitive)
-           && f.open(QIODevice::ReadOnly | QIODevice::Text);
+    return f.open(QIODevice::ReadOnly | QIODevice::Text);

Any file that can be opened as read-only returns true here. And it turns out to be even worse: passing xxx.ofx as argument to import using the OFX importer causes the CSV importer to start.
Comment 3 Dawid Wróbel 2021-04-10 14:14:20 UTC
Yes, that change you quoted is what I introduced yesterday and Brendan Coupe reported a resulting bug on the same day. The MR 71 fixes that.

However, that change actually exposed the misbehavior, which this Bug intends to track. I believe that once the file is considered as "importable", the file processing logic should not continue to check if it is "loadable".