Open Michael-cd30 opened 3 years ago
Is it for hyperlinks only or does the & anywhere in text treated the same?
@roya0045 it seems the issue is related to the parentheses (round brackets) in the link not to the ampersand:
I think the problem lies in the RegEx string used to match a valid URL in QStringUtils::insertLinks https://github.com/qgis/QGIS/blob/929b7086b1bf294bc45b6342434c49d0b4d128ed/src/core/qgsstringutils.cpp#L521-L529 as QStringUtils::insertLinks is used to add links to the value displayed in the Identify Results dialog qgsidentifyresultsdialog.cpp
@agiudiceandrea as regex are being reworked a QRegularExpression could be proposed in that pr or as a standalone pr.
This issue is still occurring in the latest QGIS version 3.26.2. See https://github.com/qgis/QGIS/issues/50066.
Describe the bug
Hyperlinks might be truncated when copied and followed from the "identify results dialog".
How to Reproduce
{ "type": "FeatureCollection", "name": "link", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "features": [ { "type": "Feature", "properties": { "link": "https:\/\/www.geoportail.gouv.fr\/carte?c=4.18014764696659,43.9934923817775&z=18&l0=TRANSPORTNETWORK.COMMONTRANSPORTELEMENTS.MARKERPOST_VISU::GEOPORTAIL:OGC:WMTS(1)&permalink=yes" }, "geometry": { "type": "Point", "coordinates": [ 4.18014764696659, 43.9934923817775 ] } } ] }
Open it on QGis
Select the point and on the identify results dialog copy or follow the link
The paste result is https://www.geoportail.gouv.fr/carte?c=4.18014764696659,43.9934923817775&z=18&l0=TRANSPORTNETWORK.COMMONTRANSPORTELEMENTS.MARKERPOST_VISU::GEOPORTAIL:OGC:WMTS(1)
but shoud be
https://www.geoportail.gouv.fr/carte?c=4.18014764696659,43.9934923817775&z=18&l0=TRANSPORTNETWORK.COMMONTRANSPORTELEMENTS.MARKERPOST_VISU::GEOPORTAIL:OGC:WMTS(1)&permalink=yes
QGIS and OS versions QGis 3.18.1 Windows 10
Additional context The copy/paste works from the attributes dialogs. The problem also occurs when the links is in a Postgis table. Tested with other links containing parenthesis, doesn't seem to be the reason; this one works : http://ang.wikipedia.org/wiki/Wikipedia:Tutorial_(Wikipedia_links).