Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed escape for </script> tag in the article content #36

Merged
merged 2 commits into from
Apr 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions pskb_website/static/js/editor_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,7 @@ function save(sha, path, secondary_repo) {
var status = response.status;
var data = response.responseJSON;
console.log(status, data);
console.log(data.error);
if (data.error) {
if (data && data.error) {
if (status < 500) {
addFlashMessage(data.error, 'bg-warning');
} else {
Expand All @@ -354,8 +353,10 @@ function save(sha, path, secondary_repo) {
$("html, body").animate({ scrollTop: 0 }, "fast");
$('#btn-save').prop('disabled', false);
}
if (data.redirect) {
if (data && data.redirect) {
setTimeout(function(){ window.location.href = data.redirect; }, 1000);
} else {
$('#btn-save').prop('disabled', false);
}
},
});
Expand Down
2 changes: 1 addition & 1 deletion pskb_website/templates/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ <h3>4. Choose your stack</h3>
$(document).ready(function() {
var local_filename = '{{ article.sha or "hack.guides-draft" }}';
{% autoescape false %}
var original_content = '{{ article.content | replace("\n", "\\n") | replace("\r", "") | replace("'", "\\'") }}';
var original_content = '{{ article.content | replace("\n", "\\n") | replace("\r", "") | replace("'", "\\'") | replace("/script", "\\/script") }}';
{% endautoescape %}
var author_name = '{{ '' if not article.author_name else article.author_name }}';
var author_real_name = '{{ '' if not article.author_real_name else article.author_real_name }}';
Expand Down