Bug report #5636
[PULL] browser loads .gz and .vrt files as both OGR and GDAL data items
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Browser | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Linux | Easy fix?: | No |
Pull Request or Patch supplied: | Yes | Resolution: | fixed |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 15201 |
Description
When a directory contains *.gz (/vsigzip/) and *.vrt (VRT) files they are recognized by both gdal and ogr providers as valid. This happens when the scanItemsInBrowser setting be set to 1 (Check extension).
The problem is that .gz files are recognized as valid because of the extension and a dataitem is created without scanning the content. Solution is to check the extension after removing .gz (eg. file.tiff.gz -> tiff)
For vrt files, both gdal and ogr support different kinds of vrt files, so extension-only checking does not work. Solution is to read the first line which contains respectively VRTDataset or OGRVRTDataSource (which is what gdal/org does to identify valid files).
Will submit a pull request briefly.
History
#1 Updated by Etienne Tourigny over 12 years ago
see pull request
https://github.com/qgis/Quantum-GIS/pull/147
#2 Updated by Giuseppe Sucameli over 12 years ago
- Resolution set to fixed
- Status changed from Open to Closed
Etienne,
I've merged your pull request (the new one, https://github.com/qgis/Quantum-GIS/pull/151) into master.
Thanks.