godotengine / godotengine/godot

BBCode parsing breaks on strings with spaces in option values

Open
#95,342 0 comments 0 reactions 0 assignees View on GitHub
bug topic:gui
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Reproducible in 4.0.2-stable, 4.1.2-stable, 4.2-stable, 33fe10c065d194b2a440a883ecdc6a71fd3fbd5f

4.0 and 4.1 don't strip of quotation marks but still split on spaces, so multi word strings are not possible.

### System information

Godot v4.3.rc (33fe10c06) - EndeavourOS #1 SMP PREEMPT_DYNAMIC Tue, 06 Aug 2024 07:21:19 +0000 - Wayland - Vulkan (Forward+) - integrated AMD Radeon Graphics (RADV RENOIR) - AMD Ryzen 5 5500U with Radeon Graphics (12 Threads)

### Issue description

The BBCode parser splits options of tags at spaces. Some options allow arbitrary strings which should allow spaces, but this breaks. E.g. `[font name="font folder/font.ttf"][/font]` or `[img tooltip="Some tooltip"][/img]`.

### Steps to reproduce

* Create a RichTextLabel
* enable BBCode
* Enter '[font name="font folder/font.ttf"][/font]`
* An error will appear saying

> Resource file not found: res://"font (expected type: Font)

### Minimal reproduction project (MRP)

[mrp.zip](https://github.com/user-attachments/files/16566772/mrp.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.