File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -213,14 +213,15 @@ const ITEM_QUERY_PARAMS = [
213213export function addQueryParametersToItemLink ( collection : STACCollection , req : Request ) {
214214 const itemsLink = collection . links . find ( ( link ) => link . rel === "items" ) ;
215215 const originalQueryString = req . originalUrl . split ( "?" ) [ 1 ] || "" ;
216-
217- const filteredParams = new URLSearchParams ( originalQueryString ) ;
218- for ( const key of [ ...filteredParams . keys ( ) ] ) {
219- if ( ! ITEM_QUERY_PARAMS . includes ( key ) ) filteredParams . delete ( key ) ;
220- }
221-
222- const queryString = filteredParams . toString ( )
223- ? `?${ decodeURIComponent ( filteredParams . toString ( ) ) } `
224- : "" ;
216+
217+ const filteredParams = originalQueryString
218+ . split ( "&" )
219+ . filter ( ( param ) => {
220+ const key = param . split ( "=" ) [ 0 ] ;
221+ return ITEM_QUERY_PARAMS . includes ( key ) ;
222+ } )
223+ . join ( "&" ) ;
224+
225+ const queryString = filteredParams ? `?${ filteredParams } ` : "" ;
225226 if ( itemsLink ) itemsLink . href = `${ itemsLink . href } ${ queryString } ` ;
226227}
You can’t perform that action at this time.
0 commit comments