diff --git a/server/camlistored/ui/blob_item.js b/server/camlistored/ui/blob_item.js index 1fe29caea..a27de2e32 100644 --- a/server/camlistored/ui/blob_item.js +++ b/server/camlistored/ui/blob_item.js @@ -208,18 +208,31 @@ camlistore.BlobItem.prototype.getDirBlobref_ = function() { * @return {string} */ camlistore.BlobItem.prototype.getTitle_ = function() { - if (this.resolvedMetaData_) { - if (this.resolvedMetaData_.camliType == 'file' && - !!this.resolvedMetaData_.file) { - return this.resolvedMetaData_.file.fileName; - } else if (this.resolvedMetaData_.camliType == 'permanode' && - !!this.resolvedMetaData_.permanode && - !!this.resolvedMetaData_.permanode.attr && - !!this.resolvedMetaData_.permanode.attr.title) { - return this.resolvedMetaData_.permanode.attr.title; - } - } - return 'Unknown title'; + if (this.metaData_) { + if (this.metaData_.camliType == 'permanode' && + !!this.metaData_.permanode && + !!this.metaData_.permanode.attr && + !!this.metaData_.permanode.attr.title) { + return this.metaData_.permanode.attr.title; + } + } + if (this.resolvedMetaData_) { + if (this.resolvedMetaData_.camliType == 'file' && + !!this.resolvedMetaData_.file) { + return this.resolvedMetaData_.file.fileName; + } + if (this.resolvedMetaData_.camliType == 'directory' && + !!this.resolvedMetaData_.dir) { + return this.resolvedMetaData_.dir.fileName; + } + if (this.resolvedMetaData_.camliType == 'permanode' && + !!this.resolvedMetaData_.permanode && + !!this.resolvedMetaData_.permanode.attr && + !!this.resolvedMetaData_.permanode.attr.title) { + return this.resolvedMetaData_.permanode.attr.title; + } + } + return 'Unknown title'; }; diff --git a/server/camlistored/ui/zembed_blob_item.js.go b/server/camlistored/ui/zembed_blob_item.js.go index 19d53f4c3..21f839cba 100644 --- a/server/camlistored/ui/zembed_blob_item.js.go +++ b/server/camlistored/ui/zembed_blob_item.js.go @@ -8,7 +8,7 @@ import "time" import "camlistore.org/pkg/fileembed" func init() { - Files.Add("blob_item.js", 7288, time.Unix(0, 1370942742232957700), fileembed.String("/**\n"+ + Files.Add("blob_item.js", 7628, time.Unix(0, 1370954334543804326), fileembed.String("/**\n"+ " * @fileoverview An item showing in a blob item container; represents a blob\n"+ " * that has already been uploaded in the system, or acts as a placeholder\n"+ " * for a new blob.\n"+ @@ -220,18 +220,31 @@ func init() { " * @return {string}\n"+ " */\n"+ "camlistore.BlobItem.prototype.getTitle_ = function() {\n"+ - " if (this.resolvedMetaData_) {\n"+ - " if (this.resolvedMetaData_.camliType == 'file' &&\n"+ - " !!this.resolvedMetaData_.file) {\n"+ - " return this.resolvedMetaData_.file.fileName;\n"+ - " } else if (this.resolvedMetaData_.camliType == 'permanode' &&\n"+ - " !!this.resolvedMetaData_.permanode &&\n"+ - " !!this.resolvedMetaData_.permanode.attr &&\n"+ - " !!this.resolvedMetaData_.permanode.attr.title) {\n"+ - " return this.resolvedMetaData_.permanode.attr.title;\n"+ - " }\n"+ - " }\n"+ - " return 'Unknown title';\n"+ + " if (this.metaData_) {\n"+ + " if (this.metaData_.camliType == 'permanode' &&\n"+ + " !!this.metaData_.permanode &&\n"+ + " !!this.metaData_.permanode.attr &&\n"+ + " !!this.metaData_.permanode.attr.title) { \n"+ + " return this.metaData_.permanode.attr.title;\n"+ + " }\n"+ + " }\n"+ + " if (this.resolvedMetaData_) {\n"+ + " if (this.resolvedMetaData_.camliType == 'file' &&\n"+ + " !!this.resolvedMetaData_.file) {\n"+ + " return this.resolvedMetaData_.file.fileName;\n"+ + " }\n"+ + " if (this.resolvedMetaData_.camliType == 'directory' &&\n"+ + " !!this.resolvedMetaData_.dir) {\n"+ + " return this.resolvedMetaData_.dir.fileName;\n"+ + " }\n"+ + " if (this.resolvedMetaData_.camliType == 'permanode' &&\n"+ + " !!this.resolvedMetaData_.permanode &&\n"+ + " !!this.resolvedMetaData_.permanode.attr &&\n"+ + " !!this.resolvedMetaData_.permanode.attr.title) {\n"+ + " return this.resolvedMetaData_.permanode.attr.title;\n"+ + " }\n"+ + " }\n"+ + " return 'Unknown title';\n"+ "};\n"+ "\n"+ "\n"+