Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Fix issue with urlencoded user handles #1221

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
prevent double encoding
  • Loading branch information
ThomasKranitsas committed Jul 8, 2017
commit 2385bd1d7915e7811dfba1c78517e5d470bb1f0d
3 changes: 0 additions & 3 deletions app/profile/profile.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ import angular from 'angular'
controller: 'ProfileCtrl as profileVm',
resolve: {
userHandle: ['$stateParams', function($stateParams) {
if (decodeURIComponent($stateParams.userHandle) !== $stateParams.userHandle) {
return decodeURIComponent($stateParams.userHandle)
}
return $stateParams.userHandle
}],
profile: ['userHandle', 'ProfileService', function(userHandle, ProfileService) {
Expand Down
9 changes: 8 additions & 1 deletion app/topcoder.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ import moment from 'moment'
if (path.indexOf('?') > -1) {
return path.replace('?', '/?')
}
$location.replace().path(path + '/')
// prevent double encoding
path = path.split('/')
for (var i = 0; i < path.length; i++) {
while (decodeURIComponent(path[i]) !== path[i]) {
path[i] = decodeURIComponent(path[i])
}
}
$location.replace().path(path.join('/') + '/')
})

var states = {
Expand Down