lizmap-web-client
lizmap-web-client copied to clipboard
[Bug]: Layer edition error when quote in postgreSQL column name
What is the bug? (in English)
When a postgis layer has a column with a quote (') in it , the edition form is in error
The js code generated by jelix doesn't escape the single quote (because QgisForm Object doesn't escape fieldname ?)
Steps to reproduce the issue
create a postgis table with a column using a single quote in its name
Versions, safeguards, check summary etc
Lizmap 3.8.7.8465 QGIS 3.34
Check Lizmap plugin
- [x] 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
Whatever
Browsers
Chrome
Browsers version
??
Relevant log output
see above.
Please share the error as text, it helps for indexation on GitHub issues, if later we search for the same error. Screenshots are not searchable yet (at list the headlines of the error), if someone doesn't know this error is linked to quote ;-)
The customer fixed the project meanwhile, and i forgot to save the browser "relevant" console output , all i have is this screenshot
more relevant log with #5654 :
js :
Uncaught SyntaxError: missing ) after argument list jQuery 15
and the js generated for the form
(function(){var c, c2;
jFormsJQ.selectFillUrl='/index.php/jelix/forms/getdata';
jFormsJQ.groupVisibilitiesUrl='/index.php/lizmap/edition/getGroupVisibilities';
jFormsJQ.config = {locale:'fr_FR',basePath:'/',jqueryPath:'/assets/jelix/jquery/',jqueryFile:'assets/js/jquery/jquery-3.5.1.min.js|defer',jelixWWWPath:'/assets/jelix/'};
jFormsJQ.tForm = new jFormsJQForm('jforms_view_edition','view~edition','0');
jFormsJQ.tForm.setErrorDecorator(new lizEditionErrorDecorator());
jFormsJQ.tForm.groupDependencies = [];
jFormsJQ.declareForm(jFormsJQ.tForm);
c = new jFormsJQControlInteger('id', 'id');
c.errRequired='La saisie de "id" est obligatoire';
c.errInvalid='La saisie de "id" est invalide';
jFormsJQ.tForm.addControl(c);
c = new jFormsJQControlInteger('BAD column name is'nt it ?', 'BAD column name is\'nt it ?');
c.required = true;
c.errRequired='La saisie de "BAD column name is\'nt it ?" est obligatoire';
c.errInvalid='La saisie de "BAD column name is\'nt it ?" est invalide';
jFormsJQ.tForm.addControl(c);
c = new jFormsJQControlString('action', 'action');
c.required = true;
c.errRequired='La saisie de "action" est obligatoire';
c.errInvalid='La saisie de "action" est invalide';
jFormsJQ.tForm.addControl(c);
c = new jFormsJQControlString('liz_future_action', 'Après enregistrement');
c.required = true;
c.errRequired='La saisie de "Après enregistrement" est obligatoire';
c.errInvalid='La saisie de "Après enregistrement" est invalide';
jFormsJQ.tForm.addControl(c);
})();