mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-15 18:34:56 -04:00
option to disable resource location validation
This commit is contained in:
parent
ce339198e3
commit
b81212dd94
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -21,4 +21,6 @@ object StaticConfiguration {
|
||||
|
||||
|
||||
const val IGNORE_SERVER_LIGHT = true
|
||||
|
||||
const val VALIDATE_RESOURCE_LOCATION = true
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
package de.bixilon.minosoft.data.registries.identified
|
||||
|
||||
import de.bixilon.minosoft.config.StaticConfiguration
|
||||
import de.bixilon.minosoft.data.language.translate.Translatable
|
||||
import de.bixilon.minosoft.data.registries.identified.ResourceLocation.Companion.ALLOWED_NAMESPACE_PATTERN
|
||||
import de.bixilon.minosoft.data.registries.identified.ResourceLocation.Companion.ALLOWED_PATH_PATTERN
|
||||
@ -39,7 +40,7 @@ open class ResourceLocation(
|
||||
get() = this
|
||||
|
||||
init {
|
||||
if (namespace.isBlank() || !ALLOWED_NAMESPACE_PATTERN.matches(namespace)) {
|
||||
if (StaticConfiguration.VALIDATE_RESOURCE_LOCATION && (namespace.isBlank() || !ALLOWED_NAMESPACE_PATTERN.matches(namespace))) {
|
||||
throw IllegalArgumentException("Invalid namespace: $namespace")
|
||||
}
|
||||
// TODO: Figure out a way to implement this but have backwards compatibility with pre flattening versions
|
||||
|
Loading…
x
Reference in New Issue
Block a user