Bug report #3283

Relative path support bug for delimited text provider

Added by Chris Crook almost 10 years ago. Updated almost 10 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:Project Loading/Saving
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

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

relative_path_fix.patch Magnifier (1.2 KB) Chris Crook, 2010-12-01 06:03 PM

Associated revisions

Revision 1c32d266
Added by Jürgen Fischer almost 10 years ago

fix #3283

git-svn-id: http://svn.osgeo.org/qgis/trunk/[email protected] c8812cc2-4d05-0410-92ff-de0c093fc19c

Revision 06f66f47
Added by Jürgen Fischer almost 10 years ago

fix #3283

git-svn-id: http://svn.osgeo.org/qgis/[email protected] c8812cc2-4d05-0410-92ff-de0c093fc19c

History

#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

Replying to [comment:2 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 06f66f47 (SVN r14904).

#4 Updated by Chris Crook almost 10 years ago

Replying to [comment:3 jef]:

right, done in 06f66f47 (SVN r14904).

Great!! Thanks

Also available in: Atom PDF