zotero / zotero-connectors

Chrome, Firefox, Edge, and Safari extensions for Zotero
https://www.zotero.org/download/connectors
Other
525 stars 124 forks source link

Incorrect library catalog when saving via proxy #88

Open dstillman opened 7 years ago

dstillman commented 7 years ago

When saving http://link.springer.com/article/10.1007/s11153-004-8034-5 via the GMU proxy, the Library Catalog is populated with link.springer.com.mutex.gmu.edu. Ideally it would be Springer Link, but failing that it should at least be link.springer.com. (The tests show different results, though I'm not sure what accounts for the difference.) It definitely shouldn't include the proxy.

zuphilip commented 7 years ago

This comes from the EM translator:

newItem.libraryCatalog = doc.location.host;

see https://github.com/zotero/translators/blob/master/Embedded%20Metadata.js#L614 (I am not a big fan of document function because they can easily fail on server environment.)

The other example is different and uses the import translator for RIS data.

adomasven commented 7 years ago

Starting Zotero 5.0 and with the new connectors ZU.urlToProxy() and ZU.urlToProper() are available in translators.

On one hand we should avoid relying on additional utility functions if possible and translators in general should be proxy agnostic. Given that EM is used in many other translators, we could address this on the Zotero side of things.

On the other hand, as there are ambitions to make EM the generic translator, maybe EM should become more proxy aware.

Note the signature doWeb(doc, url), where the url argument could be used to accommodate cases like this. At the moment the url field is not unproxied, but that could change (although I am worried it could introduce issues in child translators for resources behind proxies, but my knowledge is limited).