Fix broken documents after syncing for the first time with 2.0b5
This commit is contained in:
parent
e59bb3078f
commit
4ad2a4f5bf
|
@ -2,6 +2,26 @@ Zotero.URI = new function () {
|
||||||
var _baseURI = ZOTERO_CONFIG.BASE_URI;
|
var _baseURI = ZOTERO_CONFIG.BASE_URI;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a URI with the user's local key, if there is one
|
||||||
|
*
|
||||||
|
* @return {String|False} e.g., 'http://zotero.org/users/v3aG8nQf'
|
||||||
|
*/
|
||||||
|
this.getLocalUserURI = function () {
|
||||||
|
var key = Zotero.getLocalUserKey();
|
||||||
|
if (!key) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _baseURI + "users/local/" + Zotero.getLocalUserKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a URI for the user, creating a local user key if necessary
|
||||||
|
*
|
||||||
|
* @return {String}
|
||||||
|
*/
|
||||||
this.getCurrentUserURI = function () {
|
this.getCurrentUserURI = function () {
|
||||||
var userID = Zotero.userID;
|
var userID = Zotero.userID;
|
||||||
if (userID) {
|
if (userID) {
|
||||||
|
@ -78,13 +98,16 @@ Zotero.URI = new function () {
|
||||||
|
|
||||||
// If this is a local URI, compare to the local user key
|
// If this is a local URI, compare to the local user key
|
||||||
if (itemURI.match(/\/users\/local\//)) {
|
if (itemURI.match(/\/users\/local\//)) {
|
||||||
var currentUserURI = this.getCurrentUserURI() + "/";
|
var localUserURI = this.getLocalUserURI();
|
||||||
if (itemURI.indexOf(currentUserURI) == 0) {
|
if (localUserURI) {
|
||||||
itemURI = itemURI.substr(currentUserURI.length);
|
localUserURI += "/";
|
||||||
|
if (itemURI.indexOf(localUserURI) == 0) {
|
||||||
|
itemURI = itemURI.substr(localUserURI.length);
|
||||||
var libraryType = 'user';
|
var libraryType = 'user';
|
||||||
var libraryTypeID = null;
|
var libraryTypeID = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If not found, try global URI
|
// If not found, try global URI
|
||||||
if (!libraryType) {
|
if (!libraryType) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user