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

[4.5.1]: URL function params argument not respecting {id} #13603

Closed
KatieMFritz opened this issue Aug 24, 2023 · 1 comment
Closed

[4.5.1]: URL function params argument not respecting {id} #13603

KatieMFritz opened this issue Aug 24, 2023 · 1 comment

Comments

@KatieMFritz
Copy link
Contributor

What happened?

Description

I'm using the following code to reload a page with the ID of a newly created "lead" entry from an entry form:

redirectInput(url(baseUrl, 'lead_id={id}')

It was working originally, but after upgrading to Craft 4.5, the params argument is no longer replacing {id} with the entry ID when the form gets submitted. Instead of ?lead_id={id}, the generated URL includes ?lead_id=%7Bid%7D.

It works if I only use the path argument: redirectInput(url("#{baseUrl}?lead_id={id}")) or if I use regular Twig template interpolation: redirectInput(url(baseUrl, "lead_id=#{formId}")).

However, those options don't work for me, because my baseUrl variable has an anchor in it. If I use the params argument, the anchor gets bumped to the end and everything works, but if I only use the path argument, the params get ignored because they come after the anchor. I can split up my anchor to a separate variable and concatenate everything, but I think this is a bug.

Side note: I don't know what that type of system-generated variable is actually called: {id}. Is it a token?

Steps to reproduce

  1. Create an entry form.
  2. For the redirect URL, use the URL function. Include {id} somewhere in the params argument.
  3. Load the page and inspect the generated redirect URL.

Expected behavior

We should see {id} in the URL params for the redirect URL. Submitting the form should replace {id} with the actual ID of the newly created entry in the new URL.

Actual behavior

The redirect URL params include ?%7Bid%7D, even after submitting the form.

Craft CMS version

Craft Pro 4.5.1

PHP version

8.2.7

Operating system and version

Darwin 22.5.0

Database type and version

MySQL 8.0.33

Image driver and version

No response

Installed plugins and versions

@brandonkelly
Copy link
Member

Thanks for reporting that! Craft 4.5.2 is out with a fix.

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