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

Decode `-3D` in parameter list, refs 640, 3196 #3211

Merged
merged 1 commit into from Jul 15, 2018

Conversation

Projects
None yet
2 participants
@mwjames
Copy link
Contributor

mwjames commented Jul 14, 2018

This PR is made in reference to: #640, #3196

This PR addresses or contains:

  • #ask and its elements that contain = are assigned special treatment and encoded to solve something like #640
  • [[File:Foo.png|link=Bar]] contains = and is internally encoded with -3D to distinguish it from the first part of intro=[[File:Foo.png|link=Bar]]
  • To solve #3196, decode the second part after the general parameter processing has been completed so that original content state is restored

This PR includes:

  • Tests (unit/integration)
  • CI build passed

Fixes #3196

@mwjames mwjames added this to the SMW 3.0.0 milestone Jul 14, 2018

@mwjames mwjames merged commit d709494 into master Jul 15, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@mwjames mwjames deleted the decode-param branch Jul 15, 2018

@kghbln

This comment has been minimized.

Copy link
Member

kghbln commented Jul 15, 2018

@mwjames May this be backported to 2.5.x? I am looking for a couple of easy and tiny things to add to a 2.5.7

@mwjames

This comment has been minimized.

Copy link
Contributor Author

mwjames commented Jul 15, 2018

May this be backported to 2.5.x?

The class has changed so for 2.5.x you need adapt SMWQueryProcessor as in:

@@ -293,11 +293,11 @@ class SMWQueryProcessor implements QueryContext {
 				// #1645
 				$parts = $showMode && $name == 0 ? $rawParam : explode( '=', $rawParam, 2 );
 
 				if ( count( $parts ) >= 2 ) {
 					// don't trim here, some parameters care for " "
-					$parameters[strtolower( trim( $parts[0] ) )] = $parts[1];
+					$parameters[strtolower( trim( $parts[0] ) )] = str_replace( array( '-3D' ), array( '=' ), $parts[1] );
 				} else {
 					$queryString .= $rawParam;
 				}
 			}
 		}

I would also not recommend to backport the tests as that would cause extra work.

@kghbln

This comment has been minimized.

Copy link
Member

kghbln commented Jul 15, 2018

Thanks a lot! I will do a pull tomorrow.

@kghbln kghbln referenced this pull request Jul 16, 2018

Merged

Backport of #3196 #3223

1 of 2 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.