qwc-services / qwc-map-viewer

QWC Map viewer
MIT License
3 stars 9 forks source link

Missing parameters in URL when authentication is necessary #21

Closed MarkusAlbrechtSWM closed 8 months ago

MarkusAlbrechtSWM commented 9 months ago

When calling QWC2 with start parameters in the URL, the parameters get lost if authentication is required.

For example, if QWC2 is called with the following start parameters:

https://qwc2-host/?c=688091.313644,5338424.983487&crs=EPSG:25832&s=500&l=Layer1,Layer2&hc=true

and authentication is required, a redirect to the following URL is sent:

https://qwc2-host/login?url=https://qwc2-host/?c=688091.313644,5338424.983487&crs=EPSG:25832&s=500&l=Layer1,Layer2&hc=true

Unpacking the URL in the qwc-oidc-auth-Module with target_url = request.args.get('url', tenant_base()) leads to the loss of all parameters except one.

The cause of this problem is a missing URL encoding in the qwc-map-viewer's server.py at Line 80.

Suggested Fix

I suggest encoding request.url with urllib's urllib.parse.quote(request.url) to address this issue.

manisandro commented 8 months ago

Sorry for the late reply, missed the issue. Thanks for the report, fixed in https://github.com/qwc-services/qwc-map-viewer/commit/c42b7d1f17c10a91cbf3004c12cc400b131dbe33