From 252a6ba5d859b84d9c857d811f4e4701cded10e9 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Thu, 2 Feb 2017 12:04:22 +0100 Subject: [PATCH] strip # from filename if it is there by error. --- app/assets/javascripts/editor/submissions.js.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/editor/submissions.js.erb b/app/assets/javascripts/editor/submissions.js.erb index 4b8678a7..48cead80 100644 --- a/app/assets/javascripts/editor/submissions.js.erb +++ b/app/assets/javascripts/editor/submissions.js.erb @@ -120,7 +120,7 @@ CodeOceanEditorSubmissions = { event.preventDefault(); if ($('#render').is(':visible')) { this.createSubmission('#render', null, function (response) { - var url = response.render_url.replace(this.FILENAME_URL_PLACEHOLDER, this.active_file.filename); + var url = response.render_url.replace(this.FILENAME_URL_PLACEHOLDER, this.active_file.filename.replace(/#$/,'')); // remove # if it is the last character, this is not part of the filename and just an anchor var pop_up_window = window.open(url); if (pop_up_window) { pop_up_window.onerror = function (message) { @@ -149,7 +149,7 @@ CodeOceanEditorSubmissions = { this.showSpinner($('#run')); $('#score_div').addClass('hidden'); this.toggleButtonStates(); - var url = response.run_url.replace(this.FILENAME_URL_PLACEHOLDER, this.active_file.filename); + var url = response.run_url.replace(this.FILENAME_URL_PLACEHOLDER, this.active_file.filename.replace(/#$/,'')); // remove # if it is the last character, this is not part of the filename and just an anchor this.initializeSocketForRunning(url); }.bind(this)); } @@ -170,7 +170,7 @@ CodeOceanEditorSubmissions = { this.createSubmission('#test', null, function(response) { this.showSpinner($('#test')); $('#score_div').addClass('hidden'); - var url = response.test_url.replace(this.FILENAME_URL_PLACEHOLDER, this.active_file.filename); + var url = response.test_url.replace(this.FILENAME_URL_PLACEHOLDER, this.active_file.filenamereplace(/#$/,'')); // remove # if it is the last character, this is not part of the filename and just an anchor this.initializeSocketForTesting(url); }.bind(this)); }