#3283 closed bug (fixed)
Relative path support bug for delimited text provider
Reported by: | ccrook | Owned by: | nobody |
---|---|---|---|
Priority: | critical: causes crash or data corruption | Milestone: | Version 1.7.0 |
Component: | Project Loading / Saving | Version: | Trunk |
Keywords: | relative path delimited text provider | Cc: | |
Must Fix for Release: | No | Platform: | Windows |
Platform Version: | XP | Awaiting user input: | no |
Description
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
Attachments (1)
Change History (5)
by , 13 years ago
Attachment: | relative_path_fix.patch added |
---|
follow-up: 2 comment:1 by , 13 years ago
follow-up: 3 comment:2 by , 13 years ago
Type: | patch → bug |
---|
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.
follow-up: 4 comment:3 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Replying to ccrook:
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.
right, done in r14903.
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.