ALF-1584 - Wrong QName usage in org.alfresco.repo.jscript.ContentAwareScriptableQNameMap.get(Object name)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18950 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2010-03-02 14:38:37 +00:00
parent 9ad5ee91d3
commit 22f074c9ab

View File

@@ -76,14 +76,17 @@ public class ContentAwareScriptableQNameMap<K,V> extends ScriptableQNameMap<K,V>
{ {
// found a valid cm:content property that is not initialised // found a valid cm:content property that is not initialised
String mimetype = null; String mimetype = null;
if (qname.equals(ContentModel.PROP_CONTENT))
{
String fileName = (String)get("cm:name"); String fileName = (String)get("cm:name");
if (fileName != null) if (fileName != null)
{ {
mimetype = this.services.getMimetypeService().guessMimetype(fileName); mimetype = this.services.getMimetypeService().guessMimetype(fileName);
} }
}
ContentData cdata = new ContentData(null, mimetype, 0L, "UTF-8"); ContentData cdata = new ContentData(null, mimetype, 0L, "UTF-8");
// create the JavaScript API object we need // create the JavaScript API object we need
value = factory.new ScriptContentData(cdata, ContentModel.PROP_CONTENT); value = factory.new ScriptContentData(cdata, qname);
// and store it so it is available to the API user // and store it so it is available to the API user
put(name, value); put(name, value);
} }