Skip to content

Commit 59fa079

Browse files
authored
Merge pull request #1390 from OpenGeoscience/guard-tutorial-urls
docs: Guard tutorial urls
2 parents a43155f + 9738e85 commit 59fa079

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tutorials/common/tutorials.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ function start_keeper(alwaysKeep) {
280280
if (query.keep && alwaysKeep !== true) {
281281
newQuery.keep = query.keep;
282282
}
283+
var guard = false;
283284
$('.codeblock').each(function () {
284285
var block = $(this),
285286
defaultSrc = $('textarea', block).attr('defaultvalue'),
@@ -295,8 +296,12 @@ function start_keeper(alwaysKeep) {
295296
* average length of the url by 6 percent. */
296297
comp = comp.replace(/\//g, '.').replace(/\+/g, '-').replace(/=/g, '_');
297298
newQuery[key] = comp;
299+
guard = !(/[A-Za-z0-9]/.test(comp.slice(-1)));
298300
}
299301
});
302+
if (guard) {
303+
newQuery['_'] = '_';
304+
}
300305
if (!inPop) {
301306
utils.setQuery(newQuery, true);
302307
}

0 commit comments

Comments
 (0)