Page MenuHomePhabricator

Use database form for encoding Titles in URLs
Closed, ResolvedPublic

Description

Author: bjwyse

Description:
Notice the encoding in the url has a '+' for the space character

I found that creating an item with a link title including a space was being encoded incorrectly intermittently when refreshing the page.

As per the attachment, the link with the title 'Cork (City)' is being encoded as 'Cork+%28city%29' when it should be 'Cork_%28city%29'.

I was able to fix in my local development working copy by replacing the space with underscore before the encoding in getPageUrl in WikibaseSite.php.

public function getPageUrl( $pageName = '' ) {

$pageName = str_replace(' ', '_', $pageName);
return str_replace( '$1', urlencode( $pageName ), $this->getPageUrlPath() );

}


Version: unspecified
Severity: trivial
Whiteboard: storypoints: 8

Attached:

Screen_Shot_2012-05-20_at_10.58.37.png (337×501 px, 33 KB)

Details

Reference
bz36986

Event Timeline

bzimport raised the priority of this task from to Unbreak Now!.Nov 22 2014, 12:24 AM
bzimport set Reference to bz36986.
bzimport added a subscriber: Unknown Object (MLST).

*** Bug 36999 has been marked as a duplicate of this bug. ***

Thehelpfulonewiki wrote:

Marking as new.

Before generating URLs to the client sites, normalize the form of the title.

Use the canonical database form of the title to generate URLs to the client sites.

Sitelinks should be modeled as objects and provide accessor functions for the different syntactic forms.

Partly (?) solved in https://gerrit.wikimedia.org/r/#/c/14069/ probably should be able to return the title as well on a db-form. The URL is now unconditionally returned.

Verified in Wikidata demo time for sprint 9