GUAC-1465: Cherry-pick changes from 7da1312 for 0.9.9 re-release.
diff --git a/guacamole/src/main/webapp/app/client/directives/guacFileBrowser.js b/guacamole/src/main/webapp/app/client/directives/guacFileBrowser.js
index 1260013..c68b607 100644
--- a/guacamole/src/main/webapp/app/client/directives/guacFileBrowser.js
+++ b/guacamole/src/main/webapp/app/client/directives/guacFileBrowser.js
@@ -123,6 +123,34 @@
};
/**
+ * Recursively interpolates all text nodes within the DOM tree of
+ * the given element. All other node types, attributes, etc. will
+ * be left uninterpolated.
+ *
+ * @param {Element} element
+ * The element at the root of the DOM tree to be interpolated.
+ *
+ * @param {Object} context
+ * The evaluation context to use when evaluating expressions
+ * embedded in text nodes within the provided element.
+ */
+ var interpolateElement = function interpolateElement(element, context) {
+
+ // Interpolate the contents of text nodes directly
+ if (element.nodeType === Node.TEXT_NODE)
+ element.nodeValue = $interpolate(element.nodeValue)(context);
+
+ // Recursively interpolate the contents of all descendant text
+ // nodes
+ if (element.hasChildNodes()) {
+ var children = element.childNodes;
+ for (var i = 0; i < children.length; i++)
+ interpolateElement(children[i], context);
+ }
+
+ };
+
+ /**
* Creates a new element representing the given file and properly
* handling user events, bypassing the overhead incurred through
* use of ngRepeat and related techniques.
@@ -140,7 +168,8 @@
var createFileElement = function createFileElement(file) {
// Create from internal template
- var element = angular.element($interpolate(fileTemplate)(file));
+ var element = angular.element(fileTemplate);
+ interpolateElement(element[0], file);
// Double-clicking on unknown file types will do nothing
var fileAction = function doNothing() {};