Opened 6 years ago

Closed 6 years ago

#4466 closed defect (fixed)

[PATCH] FGDB driver does not ensure layer names are valid

Reported by: ryanl Owned by: warmerdam
Priority: normal Milestone: 1.9.1
Component: OGR_SF Version: 1.9.0
Severity: normal Keywords: FileGDB, File Geodatabase
Cc: robert.coup@…

Description

If an input contains layer names that are invalid in a FGDB the driver attempts to add them directly, error messages are displayed and the resulting database does not contain the layers.

The FGDB API also exits when you create layers with reserved words.

The attached patch cleans layer names by changing invalid characters to "_", appending "_" to reserved words, prepending "-" to unsupported prefixes, shrinks names to 160 characters and ensures uniqueness of the names. It also adds an alias to the original layer name.

I have attached an example csv/vrt that contains several layers with invalid and duplicate names.

This is similar to #4458.

References:

Attachments (3)

invalid_layers.diff (6.7 KB) - added by ryanl 6 years ago.
fix against r23791
tests.csv (66 bytes) - added by ryanl 6 years ago.
Examples I tested with
tests.vrt (2.1 KB) - added by ryanl 6 years ago.
Examples I tested with

Download all attachments as: .zip

Change History (4)

Changed 6 years ago by ryanl

Attachment: invalid_layers.diff added

fix against r23791

Changed 6 years ago by ryanl

Attachment: tests.csv added

Examples I tested with

Changed 6 years ago by ryanl

Attachment: tests.vrt added

Examples I tested with

comment:1 Changed 6 years ago by Even Rouault

Milestone: 1.9.1
Resolution: fixed
Status: newclosed
Version: svn-trunk1.9.0

Thanks. Patch committed with just a simplification : I removed the conditionnal laundering based on creation options : my quick testing shows that the SDK refuses anyway almost all the invalid cases taken into account by the patch.

Committed in trunk (r23796) and branches/1.9 (r23797)

Note: See TracTickets for help on using tickets.