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

[Bug]: data - table, virtual field with expression to show small image preview #4396

Closed
1 task done
josemvm opened this issue Apr 29, 2024 · 19 comments
Closed
1 task done

Comments

@josemvm
Copy link
Collaborator

josemvm commented Apr 29, 2024

What is the bug? (in English)

this expression here https://docs.lizmap.com/next/en/publish/lizmap_plugin/attribute_table.html#tips stop working on 3.7.7-pre.7395

Steps to reproduce the issue

try to use this expression between 3.7.6 and 3.7.7-pre versions

Versions, safeguards, check summary etc

Versions :

  • Lizmap Web Client : 3.7.7-pre.7395
  • Lizmap plugin : 4.3.5
  • QGIS Desktop : 3.28.15
  • QGIS Server : 3.28.15
  • Py-QGIS-Server : not used
  • QGIS Server plugin atlasprint : 3.3.2
  • QGIS Server plugin lizmap_server : 2.8.6
  • QGIS Server plugin wfsOutputExtension : 1.8.0
List of safeguards :
  • Mode : normal
  • Allow parent folder : no
  • Prevent other drive : no
  • Prevent PG service : no
  • Prevent PG Auth DB : no
  • Force PG user&pass : no
  • Prevent ECW : no

Check Lizmap plugin

  • I have done the step just before in the Lizmap QGIS desktop plugin before opening this ticket. Otherwise, my ticket is not considered valid and might get closed.

Operating system

Ubuntu 22.04

Browsers

Firefox

Browsers version

122.0.1

Relevant log output

No response

@josemvm josemvm added the bug label Apr 29, 2024
@Gustry
Copy link
Member

Gustry commented Apr 29, 2024

Can you elaborate ? What is is not working ? What is the error in the console ? Any picture ?

@josemvm
Copy link
Collaborator Author

josemvm commented Apr 29, 2024

@Gustry the table is not displayd at all on data tool

@Gustry
Copy link
Member

Gustry commented Apr 29, 2024

Any error message displayed in the console ? (F12)

@josemvm
Copy link
Collaborator Author

josemvm commented Apr 29, 2024

no, no errors displayed in the console, just 11:31:07 WARNING Server[15550]: Error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post body. in qgis server log file...

@Gustry
Copy link
Member

Gustry commented Apr 29, 2024

Please describe your issue @josemvm

this expression here [URL] stop working on 3.7.7-pre.7395

is very vague.

Is the panel empty ? Is the table there but empty (table headers) ?
Does it work if you remove the virtual field ? (maybe try to not expose it with WMS/WFS?)
Is the button to open the "Attribute table" panel OK ? Is the button to choose the layer to display in the panel OK ?
Is-there any error in the console when pressing one of these buttons ? (Check both "console" and "networks" tab) There must be a WFS requests sent to get the data ? Is the content of the request empty or is there an HTTP error code ?

Your first description and title mention that the expression is not working (so I understand only the tip preview is not working, then later you say : "the table is not displayd at all on data tool", so it means nothing is displayed at all ?

@josemvm
Copy link
Collaborator Author

josemvm commented Apr 29, 2024

@Gustry sorry

Is the panel empty ? Is the table there but empty (table headers) ?

the panel is not empty, the panel has de name of the table but the table doesn´t appears (no headers)

Does it work if you remove the virtual field ? (maybe try to not expose it with WMS/WFS?)

yes, it works if i remove the virtual field (just expose with WFS)

Is the button to open the "Attribute table" panel OK ? Is the button to choose the layer to display in the panel OK ?

yes

Is-there any error in the console when pressing one of these buttons ? (Check both "console" and "networks" tab) There must be a WFS requests sent to get the data ? Is the content of the request empty or is there an HTTP error code ?

no errors in the console nor in the network inspector
this is the request in apache access.log file
127.0.0.1 - - [29/Apr/2024:14:26:00 +0100] "GET /cgi-bin/qgis_mapserv.fcgi?map=%2Fvar%2Fwww%2Fhtml%2Flizmap%5Fweb%5Fclient%2Flizmap%2Finstall%2Fma%2FsigRedesA%2Eqgs&outputformat=XMLSCHEMA&request=describefeaturetype&service=WFS&typename=valvulasCorte&version=1%2E0%2E0&Lizmap%5FUser=xx%5Fxxxxx&Lizmap%5FUser%5FGroups=admins%2C%20giig%2C%20users&Lizmap%5FOverride%5FFilter=1 HTTP/1.1" 200 1742 "-" "3.7.7-pre" 10.27.10.58 - - [29/Apr/2024:14:26:00 +0100] "POST /index.php/lizmap/service HTTP/1.1" 200 1672 "http://xxxxx.xxxxx.xx/index.php/view/map?repository=ma&project=sigRedesA" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0"

@Gustry
Copy link
Member

Gustry commented Apr 29, 2024

no errors in the console nor in the network inspector

Do you have data inside ? (with the virtual field enabled)

@josemvm
Copy link
Collaborator Author

josemvm commented Apr 29, 2024

i have no the request in the console inspector like this if the virtual field is enabled:
http://xxxxx.xxxxx.xx/index.php/lizmap/service?repository=ma&project=sigRedesA&REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image%2Fpng&STYLES=1%20-%20s%2F%20Etiquetas&TRANSPARENT=true&LAYERS=bocasIncendio&DPI=96&WIDTH=2080&HEIGHT=537&CRS=EPSG%3A3763&BBOX=-49717.39180027518%2C-116553.26722038354%2C87866.21670027517%2C-81032.88367961647&ts=1714398035229

@Gustry
Copy link
Member

Gustry commented Apr 30, 2024

Your comment above is a REQUEST=GetMap related to WMS, so not linked to WFS.

When you open the attribute table, all the data is fetched with WFS.

@josemvm
Copy link
Collaborator Author

josemvm commented Apr 30, 2024

@Gustry i can provide to you an url for inspector

@Gustry
Copy link
Member

Gustry commented Apr 30, 2024

Yes, you can, with the virtual field enabled.

@Gustry
Copy link
Member

Gustry commented May 2, 2024

@josemvm I was expecting you to see the request made to QGIS server to fetch the data :

image

And we can see you got data from the server in the web browser :

image

But due to recent PR about security, this Javascript injection has been disabled.

There is still a bug that the table should have been loaded but only the content of the field should have been disabled.

CC @laurentj and @nboisteault

@nworr
Copy link
Contributor

nworr commented May 3, 2024

the DOMPurify call return a string that can't be handled by JSON.parse function

SyntaxError: JSON.parse: expected ',' or '}' after property value in object at line 1 column 374 of the JSON data
Maybe because the content is json formatted and contain escaped " and ' ?

image

PR #4409 to fix it

Another one will fix the thumbnail creation

@josemvm
Copy link
Collaborator Author

josemvm commented May 3, 2024

@nworr many thanks!

@josemvm
Copy link
Collaborator Author

josemvm commented May 3, 2024

but... it means that the thumbnail will appear in the table (or not)?

@nworr
Copy link
Contributor

nworr commented May 3, 2024

yes that's the goal ( onload= are now prohibited, but the expression may be like concat('<img src="foo" data-src=',"virtual_field" , ' class="attrirbute-thumbnal" ') , doc will be updated )

@josemvm
Copy link
Collaborator Author

josemvm commented May 3, 2024

ok, thanks again, i will try ;-)

@nworr
Copy link
Contributor

nworr commented May 7, 2024

with #4414 the data table will no longer be empty when using HTML tag with attributes in field content (virtual or not)

PR still needed for displaying a thumbnail

@Gustry
Copy link
Member

Gustry commented May 24, 2024

Documentation updated and fixed in source code.
I'm closing

@Gustry Gustry closed this as completed May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants