Skip to content

Conversation

pavog
Copy link
Member

@pavog pavog commented Feb 13, 2025

Problem
If a plugin has a dot in its name, the part after the . in the name is cut off. This is because this part is interpreted as a file extension and is not returned by

pathinfo($pluginPath, PATHINFO_FILENAME)

In the function extractPluginName(string $pluginPath): string we have to expeect that $pluginPath can be a path, a file name or a plugin name. Therefore, we must not simply cut it off after the .. Otherwise, for example, mclo.gs becomes just mclo, see this example: https://mclo.gs/4UEgJ73

Solution
We always extract the complete file name using

pathinfo($pluginPath, PATHINFO_BASENAME)
  • If $pluginPath is a path, the file name (and extension) is extracted.
  • If $pluginPath is the file name (and extension), nothing happens.
  • If $pluginPath is only the plugin name, nothing happens.

We then check whether the result ends with .jar. We can assume that it does, because plugins must always be a .jar file. Other files are not loaded from the server.

Copy link
Member

@matthi4s matthi4s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the file name of the test should better reflect what's actually being tested, e.g. paper-plugin-with-dot-error-1-21.json

@pavog pavog requested a review from matthi4s February 13, 2025 15:36
@aternosorg aternosorg deleted a comment from retr47 Jul 31, 2025
@pavog pavog merged commit 2c98530 into master Oct 13, 2025
5 checks passed
@pavog pavog deleted the fix-extract-plugin-name-with-dot branch October 13, 2025 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants