Univention Bugzilla – Full Text Bug Listing |
Summary: | Searching for settings/data data=* binary property raises UnicodeDecodeError | ||
---|---|---|---|
Product: | UCS | Reporter: | Florian Best <best> |
Component: | UDM (Generic) | Assignee: | UMC maintainers <umc-maintainers> |
Status: | NEW --- | QA Contact: | UMC maintainers <umc-maintainers> |
Severity: | normal | ||
Priority: | P5 | ||
Version: | UCS 5.0 | ||
Target Milestone: | --- | ||
Hardware: | Other | ||
OS: | Linux | ||
See Also: | https://forge.univention.org/bugzilla/show_bug.cgi?id=40740 | ||
What kind of report is it?: | Development Internal | What type of bug is this?: | --- |
Who will be affected by this bug?: | --- | How will those affected feel about the bug?: | --- |
User Pain: | Enterprise Customer affected?: | ||
School Customer affected?: | ISV affected?: | ||
Waiting Support: | Flags outvoted (downgraded) after PO Review: | ||
Ticket number: | Bug group (optional): | Error handling | |
Max CVSS v3 score: |
Description
Florian Best
2021-09-21 17:41:24 CEST
Maybe it makes sense to raise this exception, equivalent to (un) mapValue() ? diff --git management/univention-directory-manager-modules/modules/univention/admin/mapping.py management/univention-directory-manager-modules/modules/univention/admin/mapping.py index 3c575728a7..83c05d8714 100644 --- management/univention-directory-manager-modules/modules/univention/admin/mapping.py +++ management/univention-directory-manager-modules/modules/univention/admin/mapping.py @@ -557,11 +557,14 @@ class mapping(object): def mapValueDecoded(self, map_name, value): value = self.mapValue(map_name, value) - if isinstance(value, (list, tuple)): - ud.debug(ud.ADMIN, ud.WARN, 'mapValueDecoded returns a list for %s. This is probably not wanted?' % map_name) - value = [val.decode(*self.getEncoding(map_name)) for val in value] - else: - value = value.decode(*self.getEncoding(map_name)) + try: + if isinstance(value, (list, tuple)): + ud.debug(ud.ADMIN, ud.WARN, 'mapValueDecoded returns a list for %s. This is probably not wanted?' % map_name) + value = [val.decode(*self.getEncoding(map_name)) for val in value] + else: + value = value.decode(*self.getEncoding(map_name)) + except UnicodeDecodeError: + raise univention.admin.uexceptions.valueInvalidSyntax(_('Invalid encoding for %s') % (map_name,)) return value def unmapValue(self, unmap_name, value): |