Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Server][Ogc Api] Inconsistency regarding pattern handling for QgsServerOgcApiHandler #45439

Closed
1 of 2 tasks
dmarteau opened this issue Oct 6, 2021 · 0 comments · Fixed by #45450
Closed
1 of 2 tasks
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Server Related to QGIS server

Comments

@dmarteau
Copy link
Contributor

dmarteau commented Oct 6, 2021

What is the bug or the crash?

Selection of handler (QgsServerOgcApiHandler) is done using the url path, but exraction of parameters is done using the full url.

Thas means the selection and the capture of parameters do not obey same matching rules, making hard to predict the
behavior of a selection pattern with parameters.

This lead to some unexpected behavior such as getting the hostname in patterns beginning with some capture group or even getting the query part in the captured group.

Steps to reproduce the issue

  • Implement a server API where there is rule starting with a pattern like /(?P<myparam>[^/]+)/? then while the correct handler will be selected, you will get the hostname as parameter.

Example:

qgis-server_1  | 2021-10-06 19:01:38,571	DEBUG	[63]	Qgis: Server: Checking API path /tms for /(?P<tilemapid>[^/]+) 
qgis-server_1  | 2021-10-06 19:01:38,571	DEBUG	[63]	Qgis: Server: API TileMapService: found handler tilesTileMapInfo
# Here is a check of the parameter in the handler implementation
qgis-server_1  | 2021-10-06 19:01:38,572	ERROR	[63]	Qgis: tilesApi: Tile map 'localhost:19876' not found
  • Implement a server API where there is a rule starting with a pattern like /(?P<myparam>[^/]+)/? then while the correct handler will be selected you will have myparam?<query param follow> if the url does not end with /

Example using the request: http://localhost:19876/tms/france_parts.json?MAP=france_parts

Pattern was: /tms/(?P<tilemapid>[^/]+)

qgis-server_1  | 2021-10-06 19:08:26,635	DEBUG	[64]	Qgis: Server: API TileMapService accepts the URL path '/tms/france_parts.json' 
qgis-server_1  | 2021-10-06 19:08:26,635	DEBUG	[64]	Qgis: Server: Checking API path /tms/france_parts.json for /tms/(?P<tilemapid>[^/]+) 
qgis-server_1  | 2021-10-06 19:08:26,635	DEBUG	[64]	Qgis: Server: API TileMapService: found handler tilesTileMapInfo
# Here is a check of the parameter in the handler implementation
qgis-server_1  | 2021-10-06 19:08:26,636	ERROR	[64]	Qgis: tilesApi: Tile map 'france_parts.json?MAP=france_parts' not found

Versions

Qgis 3.16+

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

No response

@dmarteau dmarteau added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Oct 6, 2021
@Gustry Gustry added the Server Related to QGIS server label Oct 7, 2021
elpaso added a commit to elpaso/QGIS that referenced this issue Oct 7, 2021
elpaso added a commit to elpaso/QGIS that referenced this issue Oct 8, 2021
nyalldawson pushed a commit that referenced this issue Nov 1, 2021
dmarteau added a commit to 3liz/qgis-server-tiles-plugin that referenced this issue Jan 19, 2022
dmarteau added a commit to 3liz/py-qgis-server that referenced this issue Jan 19, 2022
    - Follow backport for qgis/QGIS#45439
dmarteau added a commit to 3liz/qgis-server-tiles-plugin that referenced this issue Oct 18, 2022
dmarteau added a commit to 3liz/qgis-server-tiles-plugin that referenced this issue Oct 18, 2022
dmarteau added a commit to 3liz/qgis-server-tiles-plugin that referenced this issue Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Server Related to QGIS server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants