@@ -2335,8 +2335,8 @@ static int msWFSRetrieveFeatures(mapObj* map,
2335
2335
2336
2336
2337
2337
if (pszFeatureId != NULL ) {
2338
- char * * tokens = NULL , * * tokens1 = NULL ;
2339
- int nTokens = 0 , j = 0 , nTokens1 = 0 , k = 0 ;
2338
+ char * * tokens = NULL ;
2339
+ int nTokens = 0 , j = 0 , k = 0 ;
2340
2340
FilterEncodingNode * psNode = NULL ;
2341
2341
char * * aFIDLayers = NULL ;
2342
2342
char * * aFIDValues = NULL ;
@@ -2359,19 +2359,25 @@ static int msWFSRetrieveFeatures(mapObj* map,
2359
2359
aFIDValues [j ] = NULL ;
2360
2360
}
2361
2361
for (j = 0 ; j < nTokens ; j ++ ) {
2362
- tokens1 = msStringSplit (tokens [j ], '.' , & nTokens1 );
2363
- if (tokens1 && nTokens1 == 2 ) {
2362
+ const char * pszLastDot = strrchr (tokens [j ], '.' );
2363
+ if (pszLastDot != NULL ) {
2364
+ char * pszLayerInFID = msStrdup (tokens [j ]);
2365
+ pszLayerInFID [pszLastDot - tokens [j ]] = '\0' ;
2366
+ /* Find if the layer is already requested */
2364
2367
for (k = 0 ; k < iFIDLayers ; k ++ ) {
2365
- if (strcasecmp (aFIDLayers [k ], tokens1 [ 0 ] ) == 0 )
2368
+ if (strcasecmp (aFIDLayers [k ], pszLayerInFID ) == 0 )
2366
2369
break ;
2367
2370
}
2371
+ /* If not, add it to the list of requested layers */
2368
2372
if (k == iFIDLayers ) {
2369
- aFIDLayers [iFIDLayers ] = msStrdup (tokens1 [ 0 ] );
2373
+ aFIDLayers [iFIDLayers ] = msStrdup (pszLayerInFID );
2370
2374
iFIDLayers ++ ;
2371
2375
}
2376
+ /* Add the id to the list of search identifiers of the layer */
2372
2377
if (aFIDValues [k ] != NULL )
2373
2378
aFIDValues [k ] = msStringConcatenate (aFIDValues [k ], "," );
2374
- aFIDValues [k ] = msStringConcatenate ( aFIDValues [k ], tokens1 [1 ]);
2379
+ aFIDValues [k ] = msStringConcatenate ( aFIDValues [k ], pszLastDot + 1 );
2380
+ msFree (pszLayerInFID );
2375
2381
} else {
2376
2382
/* In WFS 20, an unknown/invalid feature id shouldn't trigger an */
2377
2383
/* exception. Tested by CITE */
@@ -2381,15 +2387,11 @@ static int msWFSRetrieveFeatures(mapObj* map,
2381
2387
"msWFSGetFeature()" , tokens [j ]);
2382
2388
if (tokens )
2383
2389
msFreeCharArray (tokens , nTokens );
2384
- if (tokens1 )
2385
- msFreeCharArray (tokens1 , nTokens1 );
2386
2390
msFreeCharArray (aFIDLayers , iFIDLayers );
2387
2391
msFreeCharArray (aFIDValues , iFIDLayers );
2388
2392
return msWFSException (map , "featureid" , MS_OWS_ERROR_INVALID_PARAMETER_VALUE , paramsObj -> pszVersion );
2389
2393
}
2390
2394
}
2391
- if (tokens1 )
2392
- msFreeCharArray (tokens1 , nTokens1 );
2393
2395
}
2394
2396
}
2395
2397
if (tokens )
0 commit comments