Skip to content

Commit 6b5dd78

Browse files
committed
Fix issue related to invalid characters in tags being submitted.
The default behaviour of SteVe is to create a new OCPP tag if the charging point submits an unknown tag. If this tag contains invalid characters, the entry ends up in an invalid state: - you cannot see it in the OCPP tag overview page (and also isn't displayed in the unknown tag section) - if you go to the active/past sessions pane, and click through to the tag over there, you cannot edit or delete the tag since it doesn't pass validation. This bug gets triggered because some charge points send arbitrary text as a tag when FreeCharge mode is enabled. The Webasto Next [1] chargepoint I use triggers this bug, since it uses the #FreeCharging tag ID when freecharging is enabled. This PR adds the '#' sign to the whitelist of characters allowed, fixing this issue. [1]: https://charging.webasto.com/int/products/webasto-next/
1 parent 6cdc22b commit 6b5dd78

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/de/rwth/idsg/steve/web/validation/IdTag.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
@Constraint(validatedBy = {IdTagValidator.class, IdTagListValidator.class})
3737
public @interface IdTag {
3838

39-
String message() default "ID Tag can only contain upper or lower case letters, numbers and dot, colon, dash, underscore symbols";
39+
String message() default "ID Tag can only contain upper or lower case letters, numbers and dot, colon, dash, underscore or hash symbols";
4040

4141
// Required by validation runtime
4242
Class<?>[] groups() default {};

src/main/java/de/rwth/idsg/steve/web/validation/IdTagValidator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232
public class IdTagValidator implements ConstraintValidator<IdTag, String> {
3333

34-
private static final String IDTAG_PATTERN = "^[a-zA-Z0-9.:_-]{1,20}$";
34+
private static final String IDTAG_PATTERN = "^[a-zA-Z0-9.:_#-]{1,20}$";
3535
private static final Pattern PATTERN = Pattern.compile(IDTAG_PATTERN);
3636

3737
@Override

0 commit comments

Comments
 (0)