Author: jan
Date: Fri Jun 25 14:20:48 2010
New Revision: 957973
URL: http://svn.apache.org/viewvc?rev=957973&view=rev
Log:
Merge r957622 from trunk:
proper docid escaping in Futon view display, thanks Paul Bonser. Closes COUCHDB-748
Modified:
couchdb/branches/0.11.x/THANKS
couchdb/branches/0.11.x/share/www/script/futon.browse.js
couchdb/branches/0.11.x/share/www/script/futon.format.js
Modified: couchdb/branches/0.11.x/THANKS
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/THANKS?rev=957973&r1=957972&r2=957973&view=diff
==============================================================================
--- couchdb/branches/0.11.x/THANKS (original)
+++ couchdb/branches/0.11.x/THANKS Fri Jun 25 14:20:48 2010
@@ -59,5 +59,6 @@ suggesting improvements or submitting ch
* Dmitry Unkovsky <oil.crayons@gmail.com>
* Zachary Zolton <zachary.zolton@gmail.com>
* Brian Jenkins <bonkydog@bonkydog.com>
+ * Paul Bonser <pib@paulbonser.com>
For a list of authors see the `AUTHORS` file.
Modified: couchdb/branches/0.11.x/share/www/script/futon.browse.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/share/www/script/futon.browse.js?rev=957973&r1=957972&r2=957973&view=diff
==============================================================================
--- couchdb/branches/0.11.x/share/www/script/futon.browse.js [utf-8] (original)
+++ couchdb/branches/0.11.x/share/www/script/futon.browse.js [utf-8] Fri Jun 25 14:20:48 2010
@@ -152,7 +152,7 @@
page.viewName.indexOf("/_view"));
db.compactView(groupname, {success: function(resp) { callback() }});
break;
- case "view_cleanup":
+ case "view_cleanup":
db.viewCleanup({success: function(resp) { callback() }});
break;
}
@@ -178,7 +178,7 @@
}
});
}
-
+
this.databaseSecurity = function() {
$.showDialog("dialog/_database_security.html", {
load : function(d) {
@@ -672,7 +672,7 @@
if (row.id) {
$("<td class='key'><a href='document.html?" + encodeURIComponent(db.name)
+
"/" + $.couch.encodeDocId(row.id) + "'><strong></strong><br>"
+
- "<span class='docid'>ID: " + row.id + "</span></a></td>")
+ "<span class='docid'>ID: " + $.futon.escape(row.id) + "</span></a></td>")
.find("strong").text(key).end()
.appendTo(tr);
} else {
@@ -850,7 +850,7 @@
return true;
} catch (err) {
var msg = err.message;
- if (msg == "parseJSON" || msg == "JSON.parse") {
+ if (msg == "parseJSON" || msg == "JSON.parse") {
msg = "There is a syntax error in the document.";
}
$("<div class='error'></div>").text(msg).appendTo(this);
Modified: couchdb/branches/0.11.x/share/www/script/futon.format.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/share/www/script/futon.format.js?rev=957973&r1=957972&r2=957973&view=diff
==============================================================================
--- couchdb/branches/0.11.x/share/www/script/futon.format.js [utf-8] (original)
+++ couchdb/branches/0.11.x/share/www/script/futon.format.js [utf-8] Fri Jun 25 14:20:48 2010
@@ -13,6 +13,11 @@
(function($) {
$.futon = $.futon || {};
$.extend($.futon, {
+ escape: function(string) {
+ return string.replace(/&/g, "&")
+ .replace(/</g, "<")
+ .replace(/>/g, ">");
+ },
// JSON pretty printing
formatJSON: function(val, options) {
@@ -24,12 +29,6 @@
}, options || {});
var itemsep = options.linesep.length ? "," + options.linesep : ", ";
- function escape(string) {
- return string.replace(/&/g, "&")
- .replace(/</g, "<")
- .replace(/>/g, ">");
- }
-
function format(val, depth) {
var tab = [];
for (var i = 0; i < options.indent * depth; i++) tab.push("");
@@ -45,7 +44,7 @@
retval = indentLines(retval.replace(/\r\n/g, "\n"), tab.substr(options.indent));
} else {
if (options.html) {
- retval = escape(JSON.stringify(val));
+ retval = $.futon.escape(JSON.stringify(val));
} else {
retval = JSON.stringify(val);
}
@@ -92,7 +91,7 @@
if (options.quoteKeys) {
keyDisplay = keyDisplay.substr(1, keyDisplay.length - 2);
}
- keyDisplay = "<code class='key'>" + escape(keyDisplay) + "</code>";
+ keyDisplay = "<code class='key'>" + $.futon.escape(keyDisplay) +
"</code>";
if (options.quoteKeys) {
keyDisplay = '"' + keyDisplay + '"';
}
@@ -118,7 +117,7 @@
function indentLines(text, tab) {
var lines = text.split("\n");
for (var i in lines) {
- lines[i] = (i > 0 ? tab : "") + escape(lines[i]);
+ lines[i] = (i > 0 ? tab : "") + $.futon.escape(lines[i]);
}
return lines.join("<br>");
}
|