Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import failure for files with a double quote (") or \n characters in their path #60000

Open
akien-mga opened this issue Apr 7, 2022 · 1 comment

Comments

@akien-mga
Copy link
Member

Godot version

4.0.dev (5a912b0)

System information

Linux, Mageia 9 x86_64

Issue description

While working on #59998, I noticed that the import system fails on files with either " or \n (the \ and n characters, not an actual newline) in their names.

Those are actually two different bugs with slightly different symptoms, but they're both related to not properly escaping characters for paths so I'm reporting them together.

Path with \n

With a file named ic\non.png, I get this spam of errors:

Failed to get modified time for: res://ic\non.png
ERROR: Can't find file 'res://ic\non.png'.
   at: _reimport_file (editor/editor_file_system.cpp:1826)
ERROR: Can't find file 'res://ic\non.png'.
   at: _reimport_file (editor/editor_file_system.cpp:1826)
ERROR: Can't find file 'res://ic\non.png'.
   at: _reimport_file (editor/editor_file_system.cpp:1826)

Ad lib.

Path with "

Testing with a file named ic"on.png.
This actually imports fine, but then the imported file can't be loaded because the .import file has a truncated path:

ERROR: Resource file not found: res://.godot/imported/ic.
   at: _load (core/io/resource_loader.cpp:210)
ERROR: Failed loading resource: res://ic"on.png. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:205)

Indeed, the ic"on.png.import file (which can be written and read fine, no path problem here) has:

[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bbgni03s4qttg"
path="res://.godot/imported/ic"on.png-fce67098bfe0809314a688c358dbb285.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://ic\"on.png"
dest_files=["res://.godot/imported/ic\"on.png-fce67098bfe0809314a688c358dbb285.ctex"]

The dest_files is correctly escaped, but the path field is not, so it gets truncated when parsing.

Steps to reproduce

  • Create a new project
  • Rename icon.png to ic\non.png to see the first issue
  • Rename icon.png to ic"on.png to see the second issue
  • Might be Linux or Unix specific

Minimal reproduction project

TestImportPathBugs.zip

@adamscott
Copy link
Member

Congrats for the #60000 th issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants