I use "Image Link Formatter" to link to a field. Upgrading to new version 7.x-1.3 removes Query string (everything after the ? in the URL)
Removing 7.x-1.3 and installing 7.x-1.2 fixed the problem.

Thanks for your hard work.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gmclelland’s picture

I think #1955976: Allow relative paths with validation introduced a regression. I'm having similar problems with #2367069: Link 1.3 removes the query string from field tokens.

The commit at http://cgit.drupalcode.org/link/commit/?id=7965384720ca20dab256b227bbae7... is the last known good commit for me.

The commit at http://cgit.drupalcode.org/link/commit/?id=85ab462a946b60aa90011b5c4f81e... is the commit that causes problems for me.

Can you see if it this the same for you?

jcfiala’s picture

Assigned: Arm77 » jcfiala

Alright, that's pretty important. I'll try to put some time in this weekend to reproduce the problem and see why one of the tests I have didn't catch this.

gmclelland’s picture

Great, thank you @jcfiala!

karenann’s picture

I confirmed this before I actually found this thread.

If I undo the following code found in 85ab462a946b60aa90011b5c4f81ead6bd31314d, it restores expected behavior.

@@ -482,13 +490,12 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) {
$url_parts = _link_parse_url($url);
if (!empty($url_parts['url'])) {
- $item['url'] = url($url_parts['url'],
- array(
- 'query' => isset($url_parts['query']) ? $url_parts['query'] : NULL,
- 'fragment' => isset($url_parts['fragment']) ? $url_parts['fragment'] : NULL,
- 'absolute' => TRUE,
- 'html' => TRUE,
- )
+ $item['url'] = $url_parts['url'];
+ $item += array(
+ 'query' => isset($url_parts['query']) ? $url_parts['query'] : NULL,
+ 'fragment' => isset($url_parts['fragment']) ? $url_parts['fragment'] : NULL,
+ 'absolute' => !empty($instance['settings']['absolute_url']),
+ 'html' => TRUE,
);
}

The way I experience the problemis this:

I'm using the link fields to hold a link with a querystring. I am then using views to with an field using that link field. The field is set to Title only and is rewritten to include the token of the [myfield-url] == Raw url.

karenann’s picture

I haven't tested whether or not this has impacts elsewhere, but it's a start, I guess.

jcfiala’s picture

Status: Active » Needs review

If we set the ticket to "Needs review", then the automatic engine will run tests against it.

That being said, part of fixing this ticket is setting it up so that the automated tests will catch this problem in the future.

Status: Needs review » Needs work

The last submitted patch, 5: link_7.x-1.3-removes-query-string_2361283_5.patch, failed testing.

jcfiala’s picture

Hmm.. I'm not familiar with Image Link Formatter - does it use field tokens? I do have a test that makes sure a querystring is output normally, and that test is passing.

jcfiala’s picture

Oh, I see... huh. That's interesting. I didn't realize anyone was depending on that information.

gmclelland’s picture

@jcfiala - For what is worth, I'm not using the Image Link Formatter module. I'm just using the link module with the token module.

jcfiala’s picture

@gmclelland - Yes, that's what I'm working on making tests around right now. I thought I had token tests, but apparently I was testing if a token worked in the field title, not that a token referencing the field would work.

jcfiala’s picture

Status: Needs work » Postponed (maintainer needs more info)

@gmclelland - Which version of the entity (entity api) module are you using? I'm using 7.x-1.5, and I'm not having a problem with the [node:field-name:url] token so far - I generated a url which was something like http://example.com/bl83fhe#lower?property=value2, and the token was replaced with http://example.com/bl83fhe#lower?property=value2.

gmclelland’s picture

Status: Postponed (maintainer needs more info) » Active

Strange.. I'm using the 7.x-1.5 as well.

jcfiala’s picture

Title: Upgrading to new version 7.x-1.3 removes Query string » Link 7.x-1.3 removes Query string when using "Image Link Formatter" module
Assigned: jcfiala » Unassigned
Priority: Critical » Normal

Well, I'm not sure what to say here. As for Image Link Formatter, I'm not the person maintaining that module. I'm willing to work with the maintainer a bit, but this is mostly code changing internal to the link field, and there's not guarantee that things won't shift, although it's generally true that running l() or url() as listed in theme_link_formatter_link_default or theme_link_formatter_link_plain will result in a legal url.

I'm not sure we'll walk this change back or not at the moment - I'm not able to reproduce #2367069: Link 1.3 removes the query string from field tokens at the moment.

jcfiala’s picture

Status: Active » Closed (duplicate)

I may have fixed this in #2367069: Link 1.3 removes the query string from field tokens. Tomorrow, could folks try downloading the 7.x-1.x-dev version of the module and test the change and see if it fixes your problems as well? I suspect it will.

For the moment, I'm closing this as a duplicate - if we still have problems here we can re-open it.

Thanks for the help!

esod’s picture

We're migrating data into our system. The imported data for the link field may or may not have query string parameters. Using version 7.x-1.3 the query string parameters are being stripped out. We switched to 7.x-1.x-dev and the query string parameters are not being stripped out.

shaune’s picture

I use field tokens/replacement patterns in Views "Rewrite Results" and 7.x-1.3 stripped the query string. I can also confirm that the 7.x-1.x-dev version does not strip the query string parameters. Thanks for the fix!

achton’s picture