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

Trailing slashes are silently removed from filter strings #55975

Closed
2 tasks done
kannes opened this issue Jan 24, 2024 · 0 comments · Fixed by #55988
Closed
2 tasks done

Trailing slashes are silently removed from filter strings #55975

kannes opened this issue Jan 24, 2024 · 0 comments · Fixed by #55988
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!

Comments

@kannes
Copy link
Contributor

kannes commented Jan 24, 2024

What is the bug or the crash?

Trailing slashes are silently removed from filter strings

From my tests this is:

  • Happening in 3.22.16, 3.28.12, 3.34.2
  • Not happening in 3.16.16

Steps to reproduce the issue

  1. Load a geopackage, e. g. an independent copy of world_map.gpkg
  2. Set the provider filter to /* test1 */ true /* test2 */
  3. Save the project
  4. Load the project
  5. Look at the filter

The filter is now missing the trailing slash: /* test1 */ true /* test2 *

If there were multiple trailing slashes, they are all gone now. E.g. /* test1 */ true /* test2 *///// gets saved as /* test1 */ true /* test2 * too.

This does not happen for the built-in "world" geopackage.
It does happen if said geopackage is saved as independent file.
It also happens with memory layers.

Project .qgs example with the built-in world_map.gpkg where this bug does not occur

    <layer-tree-layer providerKey="ogr" checked="Qt::Checked" source="inbuilt:/data/world_map.gpkg|layername=countries|subset=/* test1 */ true /* test2 */////" id="World_Map_c6d13df6_5163_4e22_a895_ac84e747a0e4" legend_exp="" expanded="1" patch_size="-1,-1" name="World Map" legend_split_behavior="0">
...
      <datasource>inbuilt:/data/world_map.gpkg|layername=countries|subset=/* test1 */ true /* test2 */////</datasource>
...
  <ProjectGpsSettings autoCommitFeatures="0" destinationFollowsActiveLayer="1" destinationLayerName="World Map" destinationLayer="World_Map_c6d13df6_5163_4e22_a895_ac84e747a0e4" destinationLayerProvider="ogr" autoAddTrackVertices="0" destinationLayerSource="/usr/share/qgis/resources/data/world_map.gpkg|layername=countries|subset=/* test1 */ true /* test2 */////">

Project .qgs with a copy of world_map.gpkg where this bug does occur

    <layer-tree-layer providerKey="ogr" checked="Qt::Checked" source="./world_map.gpkg|layername=world_map|subset=/* test1 */ true /* test2 *" id="world_map_26516609_ca22_4cac_93e3_77de4ddc18ae" legend_exp="" expanded="1" patch_size="-1,-1" name="world_map" legend_split_behavior="0">
...
      <datasource>./world_map.gpkg|layername=world_map|subset=/* test1 */ true /* test2 */////</datasource>
...
  <ProjectGpsSettings autoCommitFeatures="0" destinationFollowsActiveLayer="1" destinationLayerName="world_map" destinationLayer="world_map_26516609_ca22_4cac_93e3_77de4ddc18ae" destinationLayerProvider="ogr" autoAddTrackVertices="0" destinationLayerSource="/tmp/world_map.gpkg|layername=world_map|subset=/* test1 */ true /* test2 *">

Versions

<style type="text/css"> p, li { white-space: pre-wrap; } </style>
QGIS version 3.34.2-Prizren QGIS code branch Release 3.34
Qt version 5.15.12
Python version 3.11.6
GDAL/OGR version 3.8.2
PROJ version 9.3.1
EPSG Registry database version v10.098 (2023-11-24)
GEOS version 3.12.0-CAPI-1.18.0
SQLite version 3.44.2
PDAL version 2.6.2
PostgreSQL client version 16.1
SpatiaLite version 5.1.0
QWT version 6.2.0
QScintilla2 version 2.14.1
OS version Manjaro Linux
       
Active Python plugins
MetaSearch 0.3.6
db_manager 0.1.20
grassprovider 2.12.99
processing 2.12.99
QGIS version 3.34.2-Prizren QGIS code branch [Release 3.34](https://github.com/qgis/QGIS/tree/release-3_34) Qt version 5.15.12 Python version 3.11.6 GDAL/OGR version 3.8.2 PROJ version 9.3.1 EPSG Registry database version v10.098 (2023-11-24) GEOS version 3.12.0-CAPI-1.18.0 SQLite version 3.44.2 PDAL version 2.6.2 PostgreSQL client version 16.1 SpatiaLite version 5.1.0 QWT version 6.2.0 QScintilla2 version 2.14.1 OS version Manjaro Linux

Active Python plugins
MetaSearch
0.3.6
db_manager
0.1.20
grassprovider
2.12.99
processing
2.12.99

Supported QGIS version

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

New profile

Additional context

This has broken our magnificient https://plugins.qgis.org/plugins/spatial_filter/ plugin :,(

@kannes kannes added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jan 24, 2024
@rouault rouault self-assigned this Jan 24, 2024
rouault added a commit to rouault/QGIS that referenced this issue Jan 24, 2024
rouault added a commit to rouault/QGIS that referenced this issue Jan 24, 2024
…use QgsProviderRegistry relativeToAbsoluteUri/absoluteToRelativeUri()

Fixes qgis#55975
nyalldawson pushed a commit that referenced this issue Jan 25, 2024
…use QgsProviderRegistry relativeToAbsoluteUri/absoluteToRelativeUri()

Fixes #55975
qgis-bot pushed a commit that referenced this issue Jan 25, 2024
…use QgsProviderRegistry relativeToAbsoluteUri/absoluteToRelativeUri()

Fixes #55975
nyalldawson pushed a commit that referenced this issue Jan 25, 2024
…use QgsProviderRegistry relativeToAbsoluteUri/absoluteToRelativeUri()

Fixes #55975
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!
Projects
None yet
2 participants