Bug report #5636
[PULL] browser loads .gz and .vrt files as both OGR and GDAL data items
|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|
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.