XUnity.AutoTranslator icon indicating copy to clipboard operation
XUnity.AutoTranslator copied to clipboard

Resize does not handle the case when there is an object name in the path containing "/"

Open lechefer opened this issue 1 year ago • 3 comments
trafficstars

The readme says the following https://github.com/bbepis/XUnity.AutoTranslator/blob/d31d141bd90ecb3f6f481b2d0f4750f19ab04d8c/README.md?plain=1#L691-L700

That is, the left side is a path that is formed from a hierarchy of objects and is separated by a delimiter /.

Example from the readme CharacterСustom/CustomControl/CanvasDraw

However, if an object comes across whose name contains a delimiter, then such a case is not processed.

The example is CharacterCustom/Custom / Control/CanvasDraw, where Custom / Control is still the same CustomControl object, and not two Custom and Control objects.

The splitting takes place here. https://github.com/bbepis/XUnity.AutoTranslator/blob/d31d141bd90ecb3f6f481b2d0f4750f19ab04d8c/src/XUnity.AutoTranslator.Plugin.Core/UIResize/UIResizeAttachment.cs#L73

We need to figure out a way to get around this. For example, through escaping or URL encoding (%2F = /)

One of the solutions is the generated ChatGPT

string path = "segment1%2Fsubsegment1/segment2/segment3%2Fsubsegment3";

string[] segments = path.Split('/');

for (int i = 0; i < segments.Length; i++)
{
    segments[i] = Uri.UnescapeDataString(segments[i]);
}

lechefer avatar Jul 23 '24 07:07 lechefer