Forward slash is being omitted in template literal if followed by a question mark

I have a template literal that looks like this /search/?dept=food but when I check it after saving, it turns into this /search?dept=food. Which is just missing the second forward slash.

I tried to escape the forward slash. Escape the question mark. And escape both at the same time, to no avail. Thank you for any help