mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
add more SERVER_SIDE_ONLY routes; use pathname in matching
This commit is contained in:
parent
116e74325a
commit
f641655f1b
@ -7,9 +7,14 @@ const TOPIC_REGEXP = /\/t\/([^\/]+)\/(\d+)\/?(\d+)?/;
|
||||
|
||||
// We can add links here that have server side responses but not client side.
|
||||
const SERVER_SIDE_ONLY = [
|
||||
/^\/assets\//,
|
||||
/^\/uploads\//,
|
||||
/^\/stylesheets\//,
|
||||
/^\/site_customizations\//,
|
||||
/^\/raw\//,
|
||||
/^\/posts\/\d+\/raw/,
|
||||
/\.rss$/,
|
||||
/\.json/,
|
||||
/\.json$/,
|
||||
];
|
||||
|
||||
let _jumpScheduled = false;
|
||||
@ -121,8 +126,9 @@ const DiscourseURL = Ember.Object.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
const pathname = path.replace(/(https?\:)?\/\/[^\/]+/, '');
|
||||
const serverSide = SERVER_SIDE_ONLY.some(r => {
|
||||
if (path.match(r)) {
|
||||
if (pathname.match(r)) {
|
||||
document.location = path;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user