Bug report #3283
Relative path support bug for delimited text provider
|Affected QGIS version:||Regression?:||No|
|Operating System:||Windows||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Copied to github as #:||13343|
Saving and loading projects can corrupt the datasourceUri for delimited text providers when the project is configured to use relative paths.
The problem is that the QgsProject readPath and writePath functions assume that the entire Uri is a file path, and change all "\\" to "/". For the delimited text provider the Uri is encoded as filename?parameters. The parameters can include regular expression defintion, which includes valid backslash characters. These get converted to slash characters, rendering the regular expression incorrect.
This is fixed by the attached patch
#1 Updated by Jürgen Fischer almost 10 years ago
Not sure that this is correct. ? is a valid character for file and directory names.
It's a bit unfortunate that we need to parse provider specific datasource strings outside of the provider. Maybe we should at some point change the providers to encode their parameters with QUrl and have some convention for filenames (e.g. file, file0, file1 for filename arguments), so that we don't need to "guess" where filename arguments are.
#2 Updated by Chris Crook almost 10 years ago
Bother! Wishful thinking on my part that ? is not valid (plus working on a less enlightened operating system by non-choice).
This does need fixing still though, if we have regular expression delimiters for the delimited text provider, as they are very likely to include "\\" characters which will get corrupted by the relative path manipulations.
As you say, ideally this would be handled by the provider, though that is a much bigger change. Another short term option (ugly though) would be to add some specific code to the QgsProject relative path manipulations for the delimited text provider, similar to what is there now for other providers.
I've changed the ticket from patch to bug. Any thoughts as to where to from here.
#3 Updated by Jürgen Fischer almost 10 years ago
- Resolution set to fixed
- Status changed from Open to Closed