Bug 395980

Summary: KF5 cannot import ofx file on MS Windows
Product: [Applications] kmymoney Reporter: Jeff <jeffjl.kde>
Component: importerAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: git (master)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Jeff 2018-06-28 22:09:10 UTC
Using 5.x git master with a craft mingw build on Windows, attempts to import an OFX file result in a a messagebox error, similar to:

"Unable to import file:///D:/Users/Jeff/Documents/KMyMoney/TestFiles/trades.ofx using the OFX importer plugin.  This file is not the correct format."

The error message is itself misleading. There is no problem with the ofx file format.

The problem is the use of QUrl.path() on Windows, so KMM couldn't find the file. If I change the 2 occurrences of url.path() to url.toLocalFile() in ofximporter.cpp the import succeeds.
Comment 1 Thomas Baumgart 2018-10-05 15:02:02 UTC
Git commit 15c9f3ac39c8719095ee9aaa66097d1bd191380b by Thomas Baumgart.
Committed on 05/10/2018 at 15:02.
Pushed by tbaumgart into branch '5.0'.

Fix problem with leading slash in filenames under ms-windows

A URL of the form file:///C:/abc.xyz is returned as /C:/abc.xyz when the
path() method is used. This causes the QFile::open() method to fail. The
QUrl::toLocalFile() method does return C:/abc.xyz in this case.
Related: bug 399378

M  +2    -3    kmymoney/kmymoney.cpp
M  +2    -2    kmymoney/plugins/ofx/import/dialogs/konlinebankingsetupwizard.cpp
M  +3    -2    kmymoney/plugins/ofx/import/ofximporter.cpp
M  +14   -8    kmymoney/plugins/ofx/import/ofxpartner.cpp
M  +1    -1    kmymoney/plugins/xml/xmlstorage.cpp

https://commits.kde.org/kmymoney/15c9f3ac39c8719095ee9aaa66097d1bd191380b