Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-268617

Structures can't be saved if the game directory is named in a certain way

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.20.4, 24w07a, 1.21
    • None
    • Community Consensus
    • Save Data
    • Low
    • Platform

      Bug Description:

      Structure blocks use FileUtils#isPathPortable to check if the path to where a structure file will be saved is valid, but the method checks improperly and returns false for valid paths. Currently, the method uses this regex:

      .*\.|(?:COM|CLOCK\$|CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\..*)?

      This regex is checked on every section of the path but it does not check it properly, it will currently match if a directory is named com.example for example this is a valid directory on Windows this is because it checks if it starts with com. when it should be checking if it starts with com0. instead, in addition to this it also does not check if it is lpt0 or com0 instead checks com[1-9] and lpt[1-9] which means it allows both through when both are also invalid file names on Windows.

      Steps to Reproduce:

      • Create a directory named com.example anywhere on your system
      • Create a Minecraft installation using that directory as the game directory
      • Start and join a world
      • Give yourself a structure block
      • Try to save a structure
      • Notice that it will be unable to save

            Unassigned Unassigned
            TheGravyBoat ThatGravyBoat
            Votes:
            7 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              CHK: