fix: enhance placeholder matching for properties parser in EggConfigu… #44

Closed
opened 2026-04-05 19:45:29 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @JellisyWoes on 10/6/2025

Description

Fixes fuzzy matching in the properties parser that was causing server-port replacements to also incorrectly modify management-server-port in Minecraft server.properties files.

Since Minecraft added the management-server-port property, the existing fuzzy matching logic would match both server-port and management-server-port when only server-port should be modified. This PR adds exact key matching for the properties parser to prevent this issue.

Changes

  • Modified EggConfigurationService::replacePlaceholders() to detect when the properties parser is being used
  • Added regex anchors (^ and $) to match patterns for properties parser configurations, ensuring exact key matching
  • Maintained backward compatibility for other parser types (yaml, xml, json, etc.) which continue to use the original matching behavior

Technical Details

When the properties parser is detected, match patterns are now wrapped with regex anchors:

  • Before: "match": "server-port" (fuzzy match)
  • After: "match": "^server-port$" (exact match)

This ensures that:

  • server-port will match only server-port
  • management-server-port will not be matched by server-port
  • Each property key is matched precisely without substring matching
*Originally created by @JellisyWoes on 10/6/2025* ## Description Fixes fuzzy matching in the properties parser that was causing `server-port` replacements to also incorrectly modify `management-server-port` in Minecraft server.properties files. Since Minecraft added the `management-server-port` property, the existing fuzzy matching logic would match both `server-port` and `management-server-port` when only `server-port` should be modified. This PR adds exact key matching for the properties parser to prevent this issue. ## Changes - Modified `EggConfigurationService::replacePlaceholders()` to detect when the properties parser is being used - Added regex anchors (`^` and `$`) to match patterns for properties parser configurations, ensuring exact key matching - Maintained backward compatibility for other parser types (yaml, xml, json, etc.) which continue to use the original matching behavior ### Technical Details When the properties parser is detected, match patterns are now wrapped with regex anchors: - **Before**: `"match": "server-port"` (fuzzy match) - **After**: `"match": "^server-port$"` (exact match) This ensures that: - `server-port` will match **only** `server-port` - `management-server-port` will **not** be matched by `server-port` - Each property key is matched precisely without substring matching
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/pyrodactyl#44