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

Saving structure with name containing two consecutive dots logs error "java.io.IOException: Invalid relative path to resource"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 1.13-pre2, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 18w50a, Minecraft 19w02a
    • Fix Version/s: Minecraft 19w13b
    • Labels:
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      The bug

      Saving a structure with a name containing two consecutive dots (..) logs the error

      Couldn't load structure <structure_name>: java.io.IOException: Invalid relative path to resource: <resource_path>
      

      This is likely caused by the code trying to load the structure from data packs. Loading them from and saving them to the generated/<namespace>/structures folder of a world works fine.

      Either way two consecutive dots can form perfectly valid paths when they are in the middle (e.g. a..b) or at the beginning (e.g. ..a) of a path piece, therefore this check should be more precisely and the error message should include, that this is data pack related only.

      How to reproduce

      1. /setblock ~ ~ ~ structure_block[mode=save]{mode:"SAVE",name:"a..b"}
        
      2. Open the structure block GUI and click "SAVE"
      3. Look at the log
        The following error appeared
        Couldn't load structure minecraft:a..b: java.io.IOException: Invalid relative path to resource: minecraft:structures/a..b.nbt
        

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              marcono1234 [Mod] Marcono1234
            • Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                CHK: