Skip to content

Commit

Permalink
/vsitar/: fix support of /vsitar/ of /vsitar/
Browse files Browse the repository at this point in the history
Fixes #10821
  • Loading branch information
rouault committed Sep 18, 2024
1 parent 768ec26 commit a0d8d77
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 @@ -649,6 +649,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 Eof() 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 @@ -946,10 +946,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 a0d8d77

Please sign in to comment.