zotero / citeproc-js-server

Web service to generate citations and bibliographies using citeproc-js
Other
60 stars 39 forks source link

Missing title causes HTTP 500 #15

Closed markwallsgrove closed 9 years ago

markwallsgrove commented 10 years ago

Within lib/citeproc.js:8909 there is a line of code that looks like:

   } else if ("object" === typeof Item[variable]) {
       if (Item[variable].length) {
       }
       break;
  }

I am unsure why the embedded if statement exists as it doesn't look to be doing anything. I believe when a title is missing this causes a HTTP 500 error message to occur (Item[variable] returns a null). If possible I will attempt to provide the HTTP request that causes this problem.

ERR! Error while handling request:  TypeError: Cannot read property 'length' of null
ERR! Error while handling request:      at func (/home/mark/workspace/citeproc/lib/citeproc.js:8908:39)
ERR! Error while handling request:      at CSL.tokenExec (/home/mark/workspace/citeproc/lib/citeproc.js:749:26)
ERR! Error while handling request:      at CSL.getCite (/home/mark/workspace/citeproc/lib/citeproc.js:3989:30)
ERR! Error while handling request:      at CSL.getBibliographyEntries (/home/mark/workspace/citeproc/lib/citeproc.js:4324:50)
ERR! Error while handling request:      at CSL.Engine.makeBibliography (/home/mark/workspace/citeproc/lib/citeproc.js:4140:38)
ERR! Error while handling request:      at Promise.resolve.then.then.then.catch.msg (/home/mark/workspace/citeproc/lib/citeServer.js:288:48)
ERR! Error while handling request:      at tryCatch1 (/home/mark/workspace/citeproc/node_modules/bluebird/js/main/util.js:64:19)
ERR! Error while handling request:      at Promise$_callHandler [as _callHandler] (/home/mark/workspace/citeproc/node_modules/bluebird/js/main/promise.js:706:13)
ERR! Error while handling request:      at Promise$_settlePromiseFromHandler [as _settlePromiseFromHandler] (/home/mark/workspace/citeproc/node_modules/bluebird/js/main/promise.js:722:18)
ERR! Error while handling request:      at Promise$_settlePromiseAt [as _settlePromiseAt] (/home/mark/workspace/citeproc/node_modules/bluebird/js/main/promise.js:892:14)
ERR! Error while handling request:   [TypeError: Cannot read property 'length' of null]
fcheslack commented 9 years ago

I imagine this would have been a problem with citeproc.js or the style not being valid (and I'm not sure which title was referred to).