Skip to content

Commit

Permalink
assume the hash is encoded to handle tags with % sign in hash
Browse files Browse the repository at this point in the history
  • Loading branch information
niol committed Dec 29, 2016
1 parent d02a159 commit 12fedd2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion public/js/selfoss-events-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ selfoss.events.navigation = function() {
$(this).addClass('active');

if($(this).hasClass('nav-tags-all')==false) {
location.hash = '#' + selfoss.filter.type + '/tag-' + $(this).find('span').html();
location.hash = '#' + selfoss.filter.type + '/tag-' + $(this).find('span').html().replace('%', '%25');
} else {
location.hash = '#' + selfoss.filter.type + '/all';
}
Expand Down
13 changes: 8 additions & 5 deletions public/js/selfoss-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ selfoss.events = {
* handle History change
*/
hashChange: function() {
if( location.hash == selfoss.events.lasthash )
// assume the hash is encoded
var hash = decodeURIComponent(location.href.split('#').splice(1).join('#'));

if( hash == selfoss.events.lasthash )
return;

// parse hash
var hashPath = location.hash.substring(1).split('/');
var hashPath = hash.split('/');

selfoss.events.section = hashPath[0];

Expand All @@ -69,7 +72,7 @@ selfoss.events = {
else
selfoss.events.entryId = null;

selfoss.events.lasthash = location.hash;
selfoss.events.lasthash = hash;

// do not reload list if list is the same
if ( selfoss.events.lastpath == selfoss.events.path )
Expand All @@ -81,7 +84,7 @@ selfoss.events = {
selfoss.filter.tag = '';
selfoss.filter.source = '';
if( selfoss.events.subsection.substr(0, 4) == 'tag-') {
selfoss.filter.tag = decodeURIComponent(selfoss.events.subsection.substr(4));
selfoss.filter.tag = selfoss.events.subsection.substr(4);
} else if( selfoss.events.subsection.substr(0, 7) == 'source-') {
var sourceId = parseInt(selfoss.events.subsection.substr(7));
if( sourceId ) {
Expand All @@ -94,7 +97,7 @@ selfoss.events = {

$('#nav-filter-'+selfoss.events.section).click();
selfoss.reloadList();
} else if(location.hash=="#sources") { // load sources
} else if(hash=="sources") { // load sources
if (selfoss.activeAjaxReq !== null)
selfoss.activeAjaxReq.abort();

Expand Down

0 comments on commit 12fedd2

Please sign in to comment.