FIX: Add secure media url to SERVER_SIDE_ONLY list (#11348)

This commit is contained in:
Martin Brennan 2020-11-25 14:31:31 +10:00 committed by GitHub
parent 2348a7972e
commit 5028aaf446
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -16,6 +16,7 @@ const TOPIC_REGEXP = /\/t\/([^\/]+)\/(\d+)\/?(\d+)?/;
const SERVER_SIDE_ONLY = [
/^\/assets\//,
/^\/uploads\//,
/^\/secure-media-uploads\//,
/^\/stylesheets\//,
/^\/site_customizations\//,
/^\/raw\//,

View File

@ -96,4 +96,15 @@ module("Unit | Utility | url", function () {
"https://www.discourse.org/mailto:foo"
);
});
test("routeTo redirects secure media URLS because they are server side only", async function (assert) {
sinon.stub(DiscourseURL, "redirectTo");
sinon.stub(DiscourseURL, "handleURL");
DiscourseURL.routeTo("/secure-media-uploads/original/1X/test.pdf");
assert.ok(
DiscourseURL.redirectTo.calledWith(
"/secure-media-uploads/original/1X/test.pdf"
)
);
});
});