Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#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)

relative_path_fix.patch (1.2 KB ) - added by ccrook 13 years ago.

Download all attachments as: .zip

Change History (5)

by ccrook, 13 years ago

Attachment: relative_path_fix.patch added

comment:1 by jef, 13 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.

in reply to:  1 ; comment:2 by ccrook, 13 years ago

Type: patchbug

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.

in reply to:  2 ; comment:3 by jef, 13 years ago

Resolution: fixed
Status: newclosed

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.

in reply to:  3 comment:4 by ccrook, 13 years ago

Replying to jef:

right, done in r14903.

Great!! Thanks

Note: See TracTickets for help on using tickets.