Skip to content

Commit 486aa52

Browse files
authored
Merge pull request OSGeo#11874 from rouault/fix_11836
OpenFileGDB: accept /vsizip/some_random_filename.zip where content is directly at top-level
2 parents b746f1a + 78040dd commit 486aa52

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed
75.9 KB
Binary file not shown.

autotest/ogr/ogr_openfilegdb.py

+9
Original file line numberDiff line numberDiff line change
@@ -2958,3 +2958,12 @@ def test_ogr_openfilegdb_weird_gdbindexes():
29582958
lyr.SetAttributeFilter("id = '1'")
29592959
f = lyr.GetNextFeature()
29602960
assert f
2961+
2962+
2963+
###############################################################################
2964+
2965+
2966+
def test_ogr_openfilegdb_vsizip_random_zip_name_and_no_gdb_subdir():
2967+
2968+
with ogr.Open("/vsizip/data/filegdb/testopenfilegdb.zip") as ds:
2969+
assert ds.GetLayerCount() == 37

ogr/ogrsf_frmts/openfilegdb/ogropenfilegdbdrivercore.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,17 @@ GDALIdentifyEnum OGROpenFileGDBDriverIdentify(GDALOpenInfo *poOpenInfo,
111111
}
112112
#endif
113113

114+
else if (STARTS_WITH(pszFilename, "/vsizip/") && poOpenInfo->bIsDirectory)
115+
{
116+
VSIStatBufL stat;
117+
return VSIStatL(
118+
CPLFormFilenameSafe(pszFilename, "a00000001", "gdbtable")
119+
.c_str(),
120+
&stat) == 0
121+
? GDAL_IDENTIFY_TRUE
122+
: GDAL_IDENTIFY_FALSE;
123+
}
124+
114125
else if (EQUAL(pszFilename, "."))
115126
{
116127
GDALIdentifyEnum eRet = GDAL_IDENTIFY_FALSE;

0 commit comments

Comments
 (0)