Skip to content

Commit

Permalink
Merge pull request #10824 from rouault/fix_10821
Browse files Browse the repository at this point in the history
/vsitar/: fix support of /vsitar/ of /vsitar/
  • Loading branch information
rouault committed Sep 18, 2024
2 parents e5bb066 + eff841f commit c8a0113
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Binary file added autotest/gcore/data/tar_of_tar_gzip.tar
Binary file not shown.
9 changes: 9 additions & 0 deletions autotest/gcore/vsifile.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,15 @@ def test_vsifile_14():
)


###############################################################################
# Test bugfix for https://github.com/OSGeo/gdal/issues/10821


def test_vsifile_vsitar_of_vsitar():

gdal.Open("/vsitar/{/vsitar/data/tar_of_tar_gzip.tar}/byte_tif.tar.gz/byte.tif")


###############################################################################
# Test issue with Error() not detecting end of corrupted gzip stream (#6944)

Expand Down
8 changes: 5 additions & 3 deletions port/cpl_vsil_gzip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -960,10 +960,12 @@ bool VSIGZipHandle::gzseek(vsi_l_offset offset, int whence)
{
m_uncompressed_size = out;

if (m_pszBaseFileName &&
!STARTS_WITH_CI(m_pszBaseFileName, "/vsicurl/") &&
m_bWriteProperties)
if (m_pszBaseFileName && !STARTS_WITH(m_pszBaseFileName, "/vsicurl/") &&
!STARTS_WITH(m_pszBaseFileName, "/vsitar/") &&
!STARTS_WITH(m_pszBaseFileName, "/vsizip/") && m_bWriteProperties)
{
CPLErrorStateBackuper oErrorStateBackuper(CPLQuietErrorHandler);

CPLString osCacheFilename(m_pszBaseFileName);
osCacheFilename += ".properties";

Expand Down

0 comments on commit c8a0113

Please sign in to comment.