GodotNuts / GodotFirebase

Implementations of Firebase for Godot using GDScript
MIT License
517 stars 74 forks source link

Storage paths can now have space characters #387

Closed Vitorgus closed 4 months ago

Vitorgus commented 4 months ago

I was trying to create a new file in the Firebase Storage with space characters in the file name, e.g:

Firebase.Storage.ref("path with space/image.png").put_file("res://image.png")

But it would fail, even if Firebase allows paths to have spaces. Turns out it was because the space character wasn't being encoded in the url parameter, only the forward slash / was.

Using the ~uri_encode()~ http_escape, it should encode both the slash and space characters, as well as any other character.

~The target is set to main, but can switch to 4.x if that's the correct branch.~

EDIT: my base branch was created from main, so updated to use the godot 3 function instead

Vitorgus commented 4 months ago

When switching to the target branch 4.0, a lot of new diff appeared. I created my fix branch originally from main, so to avoid merging stuff from main (that seems to be the godot 3 version) into 4.0 (the godot 4 version), I replaced the function with the godot 3 equivalent http_escape(). Will open a new PR for the 4.0 properly.