mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2025-02-16 01:41:26 +01:00
Block non-alphanumeric characters, underscores and dashes from sql table prefix
This commit is contained in:
parent
baf7e5027b
commit
affa127906
@ -71,14 +71,19 @@ public abstract class SQLStorage implements Storage {
|
||||
}
|
||||
|
||||
protected String tablePrefix() {
|
||||
return discordSRV.connectionConfig().storage.sqlTablePrefix;
|
||||
String tablePrefix = discordSRV.connectionConfig().storage.sqlTablePrefix;
|
||||
if (!tablePrefix.matches("[\\w_-]*")) {
|
||||
throw new IllegalStateException("SQL Table prefix may not contain non alphanumeric characters, dashes and underscores!");
|
||||
}
|
||||
|
||||
return tablePrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
useConnection((CheckedConsumer<Connection>) connection -> createTables(
|
||||
connection,
|
||||
discordSRV.connectionConfig().storage.sqlTablePrefix
|
||||
tablePrefix()
|
||||
));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user