Bug 52719 - Javascript widget should check exam name | ValueError: Das angegebene Projektverzeichnis darf nicht mit einem "." beginnen oder enden.
Javascript widget should check exam name | ValueError: Das angegebene Projekt...
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: UMC - Exam mode
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 5.0 v3
Assigned To: Johannes Königer
Johannes Keiser
https://git.knut.univention.de/univen...
:
Depends on:
Blocks: 54908
  Show dependency treegraph
 
Reported: 2021-01-29 14:25 CET by Christian Castens
Modified: 2022-08-04 18:35 CEST (History)
9 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 5: Blocking further progress on the daily work
User Pain: 0.229
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2020091821000258, 2022052321000368
Bug group (optional): Error handling, External feedback
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Castens univentionstaff 2021-01-29 14:25:36 CET
Version: 4.4-4 errata648 (Blumenthal) - UCS@school 4.4 v5

Remark: Fehler beim Speichern einer Klassenarbeit

Error:
Interner Server-Fehler in "schoolexam/exam/add".
Request: schoolexam/exam/add

Traceback (most recent call last):
  File "%PY2.7%/univention/management/console/base.py", line 359, in __error_handling
    six.reraise(etype, exc, etraceback)
  File "%PY2.7%/univention/management/console/base.py", line 262, in execute
    function.__func__(self, request, *args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/decorators.py", line 181, in _response
    return function(self, request)
  File "%PY2.7%/univention/management/console/modules/schoolexam/__init__.py", line 369, in add
    self._save_exam(request)
  File "%PY2.7%/ucsschool/lib/school_umc_ldap_connection.py", line 123, in wrapper_func
    return func(*args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/schoolexam/__init__.py", line 290, in _save_exam
    project.validate()
  File "%PY2.7%/univention/management/console/modules/distribution/util.py", line 375, in validate
    raise ValueError(_('The specified project directory may not start nor end with a ".".'))
ValueError: Das angegebene Projektverzeichnis darf nicht mit einem "." beginnen oder enden.

Role: domaincontroller_slave
Comment 1 Daniel Tröder univentionstaff 2021-02-02 09:56:29 CET
I guess this should be checked by the JavaScript widget, to prevent users from ever seeing this error.
Comment 2 Daniel Duchon univentionstaff 2022-05-23 12:45:58 CEST
Another Customer is asking for this.
Comment 4 Florian Best univentionstaff 2022-06-28 15:12:57 CEST
(In reply to Daniel Tröder from comment #1)
> I guess this should be checked by the JavaScript widget, to prevent users
> from ever seeing this error.

well, but it should also be handled in the backend.
The error is already handled in the project distribution module but not in the schoolexam module:

ucs-school-umc-distribution/umc/python/distribution/__init__.py
273 »   »   »   # initiate project and validate its values
274 »   »   »   try:
275 »   »   »   »   project.validate()
276 »   »   »   except ValueError as exc:
277 »   »   »   »   raise UMC_Error(str(exc))

Best would be if the exam module would also handle that exception and gives that error message back into the javascript form.
Comment 5 Daniel Tröder univentionstaff 2022-06-29 09:16:47 CEST
I concur: it should be checked at exam creation time in both the frontend and the backend.
Comment 6 Johannes Königer univentionstaff 2022-06-29 18:29:42 CEST
https://git.knut.univention.de/univention/ucsschool/-/merge_requests/123

The proposed merge request introduces the following changes:

The front-end recognizes now all invalid exam directory names. On SAVE EXAM any incorrect exam directory name will be detected by the backend (for the 5.0 branch, this already worked except for cases like ".." and "."). The tool-tip for the validation textbox includes that spaces or "." are not allowed at the start or end of the name.
Comment 7 Johannes Keiser univentionstaff 2022-07-12 09:53:41 CEST
OK: Invalid directory name detected on SAVE and START
OK: yaml
-> can be merged and built
Comment 8 Tobias Wenzel univentionstaff 2022-07-12 15:27:02 CEST
(merge after release)

Changed target milestone to 5.0 v2 errata.
Comment 9 Johannes Königer univentionstaff 2022-07-21 07:52:02 CEST
Merged with 2e8eab11:
* The front-end recognizes now all invalid exam directory names
* Any incorrect exam directory name will be detected by the backend and an appropriate error message is shown
* The tool-tip for the validation textbox includes that spaces or "." are not allowed at the start or end of the name
Comment 10 Jürn Brodersen univentionstaff 2022-08-04 18:35:50 CEST
UCS@school 5.0 v3 has been released.

https://docs.software-univention.de/changelog-ucsschool-5.0v3-de.html

If this error occurs again, please clone this bug.