Skip to content

Commit

Permalink
Change mod ID regex to allow '.' in mod IDs (#203)
Browse files Browse the repository at this point in the history
Also add mod ID format to the contract of getModId()
  • Loading branch information
lukebemish authored Nov 19, 2024
1 parent ee3c2b9 commit 496b519
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class ModInfo implements IModInfo, IConfigurable {
private static final Logger LOGGER = LogUtils.getLogger();
private static final DefaultArtifactVersion DEFAULT_VERSION = new DefaultArtifactVersion("1");
private static final Pattern VALID_MODID = Pattern.compile("^[a-z][a-z0-9_]{1,63}$");
private static final Pattern VALID_MODID = Pattern.compile("^(?=.{2,64}$)[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)*$");
private static final Pattern VALID_NAMESPACE = Pattern.compile("^[a-z][a-z0-9_.-]{1,63}$");
private static final Pattern VALID_VERSION = Pattern.compile("^\\d+.*");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ public interface IModInfo {
*/
IModLanguageLoader getLoader();

/**
* {@return the mod id}
* Mod IDs must satisfy the following requirements:
* <ul>
* <li>be from 2 to 64 characters long
* <li>contain only lowercase letters, digits, underscores, and periods
* <li>each dot-separated section must start with a lowercase letter
* </ul>
*/
String getModId();

String getDisplayName();
Expand Down

0 comments on commit 496b519

Please sign in to comment.