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.x]: Empty query string in preview target URLs #11159

Closed
mmikkel opened this issue May 8, 2022 · 2 comments
Closed

[4.x]: Empty query string in preview target URLs #11159

mmikkel opened this issue May 8, 2022 · 2 comments

Comments

@mmikkel
Copy link
Contributor

mmikkel commented May 8, 2022

What happened?

Description

Preview target URLs will always have an ? (i.e. an empty query string) appended to them, even if there isn't a query string in the "URL Format" setting for that preview target.

Steps to reproduce

  1. Create a section and add a preview target to it with a "URL Format" that doesn't include a query string – for example, {url}
  2. Create an entry in that section
  3. Click the "View" button in entry's edit page to open the preview target URL in a new browser tab
  4. Observe that the URL has an empty query string (i.e. ?) appended to it

Expected behavior

No question mark appended to the URL unless the preview target's URL format has a query string.

Actual behavior

There's a question mark appended to the URL even if there isn't a query string in the preview target's URL format.

Craft CMS version

4.0.1

PHP version

8.1.4

Operating system and version

macOS 12.3.1

Database type and version

MySQL 5.7.37

Image driver and version

No response

Installed plugins and versions

None

@mmikkel mmikkel changed the title [4.x]: Empty query string in preview target URLs via the "View" button [4.x]: Empty query string in preview target URLs May 8, 2022
brandonkelly added a commit that referenced this issue May 9, 2022
@brandonkelly
Copy link
Member

Thanks for pointing that out! Fixed for the next release.

@brandonkelly
Copy link
Member

Craft 4.0.2 is out now with the fix for this.

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