Always allow charging station ID with special chars
MODIFY
src/server/ocpp/utils/OCPPUtils.ts
src/server/ocpp/utils/OCPPUtils.ts
@@ -1453,15 +1453,14 @@ export default class OCPPUtils {
// Set the Tenant ID
headers.tenantID = tenantID;
headers.token = token;
- // TODO: To allow to fix a charging station in production, will be reverted shortly after
- // if (!Utils.isChargingStationIDValid(headers.chargeBoxIdentity)) {
- // throw new BackendError({
- // source: headers.chargeBoxIdentity,
- // module: MODULE_NAME,
- // method: 'normalizeAndCheckSOAPParams',
- // message: 'The Charging Station ID is invalid'
- // });
- // }
+ if (!Utils.isChargingStationIDValid(headers.chargeBoxIdentity)) {
+ throw new BackendError({
+ source: headers.chargeBoxIdentity,
+ module: MODULE_NAME,
+ method: 'normalizeAndCheckSOAPParams',
+ message: 'The Charging Station ID is invalid'
+ });
+ }
}
public static async setAndSaveChargingProfile(tenantID: string, chargingProfile: ChargingProfile, user?: UserToken): Promise<string> {

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
@@ -1363,8 +1363,10 @@ export default class Utils {
}
public static isChargingStationIDValid(name: string): boolean {
+ // TODO: Put the check after production fix
+ return true;
// eslint-disable-next-line no-useless-escape
- return /^[A-Za-z0-9_\.\-~]*$/.test(name);
+ // return /^[A-Za-z0-9_\.\-~]*$/.test(name);
}
public static isPasswordValid(password: string): boolean {

Always allow charging station ID with special chars