Merge pull request #4660 from ryantm/serversideonly
add more SERVER_SIDE_ONLY routes; use pathname in matching
This commit is contained in:
commit
0c71e37aab
|
@ -7,10 +7,15 @@ const TOPIC_REGEXP = /\/t\/([^\/]+)\/(\d+)\/?(\d+)?/;
|
||||||
|
|
||||||
// We can add links here that have server side responses but not client side.
|
// We can add links here that have server side responses but not client side.
|
||||||
const SERVER_SIDE_ONLY = [
|
const SERVER_SIDE_ONLY = [
|
||||||
|
/^\/assets\//,
|
||||||
|
/^\/uploads\//,
|
||||||
|
/^\/stylesheets\//,
|
||||||
|
/^\/site_customizations\//,
|
||||||
|
/^\/raw\//,
|
||||||
/^\/posts\/\d+\/raw/,
|
/^\/posts\/\d+\/raw/,
|
||||||
/^\/raw\/\d+/,
|
/^\/raw\/\d+/,
|
||||||
/\.rss$/,
|
/\.rss$/,
|
||||||
/\.json/,
|
/\.json$/,
|
||||||
];
|
];
|
||||||
|
|
||||||
let _jumpScheduled = false;
|
let _jumpScheduled = false;
|
||||||
|
@ -122,8 +127,9 @@ const DiscourseURL = Ember.Object.extend({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pathname = path.replace(/(https?\:)?\/\/[^\/]+/, '');
|
||||||
const serverSide = SERVER_SIDE_ONLY.some(r => {
|
const serverSide = SERVER_SIDE_ONLY.some(r => {
|
||||||
if (path.match(r)) {
|
if (pathname.match(r)) {
|
||||||
document.location = path;
|
document.location = path;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue