Skip to content

Commit

Permalink
fix CPL_VSIL_CURL_ALLOWED_EXTENSIONS with query string (WIP) (#1614)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbonfort authored and rouault committed Jun 5, 2019
1 parent 38c1e38 commit b3d3feb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gdal/port/cpl_vsil_curl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2774,6 +2774,14 @@ bool VSICurlFilesystemHandler::IsAllowedFilename( const char* pszFilename )
{
char** papszExtensions =
CSLTokenizeString2( pszAllowedExtensions, ", ", 0 );
const char *queryStart = strchr(pszFilename, '?');
char *pszFilenameWithoutQuery = nullptr;
if (queryStart != nullptr)
{
pszFilenameWithoutQuery = CPLStrdup(pszFilename);
pszFilenameWithoutQuery[queryStart - pszFilename]='\0';
pszFilename = pszFilenameWithoutQuery;
}
const size_t nURLLen = strlen(pszFilename);
bool bFound = false;
for( int i = 0; papszExtensions[i] != nullptr; i++ )
Expand All @@ -2798,6 +2806,9 @@ bool VSICurlFilesystemHandler::IsAllowedFilename( const char* pszFilename )
}

CSLDestroy(papszExtensions);
if( pszFilenameWithoutQuery ) {
CPLFree(pszFilenameWithoutQuery);
}

return bFound;
}
Expand Down

0 comments on commit b3d3feb

Please sign in to comment.