- Create userdata tables and indexes that are missing
- Delete tables and triggers that should no longer exist
- Run schema integrity check before user data migration
- Run schema integrity check after restart error
This is meant to address two problems:
1) Database damage, and subsequent use of the DB Repair Tool, that
results in missing tables
2) A small number of cases of schema update steps somehow not being
reflected in users' databases despite their having updated userdata
numbers, which are set within the same transaction. Until we figure
out how that's happening, we should start adding conditional versions
of schema update steps to the integrity check.
This is currently only running the update check after a restart error,
which might not occur for all missed schema update steps, so we might
want other triggers for calling setIntegrityCheckRequired().
- Using `sandboxPrototype` properly uses window as prototype
- This commit removes the need for our patch in babel-worker.js:
3d0bc4cf9f
- We properly inject into frames in the client if we ever include frames
4bc8fab4f5 added support for `proxy: false` on attachment URLs in
translators, but it made that flag skip `resolveURL()` altogether, which
meant that relative URLs weren't resolved, rather than just skipping
proxying.
This may fix PDF downloads for some ScienceDirect pages (though I can't
test this one):
https://forums.zotero.org/discussion/85884/problem-downloading-pdf-via-zotero
Our SingleFileZ integration would save images inside directories following the
SingleFileZ format. However, Zotero does not support syncing sub-directories of
attachments. This commit switch back to a single HTML file with base64 encoded
resources. We think that the 33% increase in resources will be offset by the
compression of HTML and removal of JavaScript and unused CSS.
This commit does not fix past snapshots that were saved using SingleFileZ.
- Remove TODO comment to add a warning if a Document is passed, since a
document will always be required when operating on something other than
the main page (e.g., for multiples).
- Always return a string instead of null. A translator can always use
querySelector() if it really needs to know if a node exists.
- Automatically trim the returned string
- Add innerText() function that uses .innerText instead of .textContent,
since there are situations where that might be helpful. Some of those we
currently address with trimInternal(), but there can be other
cases where .innerText gives cleaner, user-centric output.
Translators won't be able to rely on these changes for a while, so we'll
need to be careful to watch for problems here, or translators will need
to include a v3 polyfill.
Addresses zotero/translators#1913
Sending value as a string to "removeCreator" breaks the logic in the
loop in that method which is supposed to remove target creator and shift
remaining creators in the array. This in turn triggers undesired removal
of the last creator in the array.
- Use `new URL()`, available in all modern environments, instead of
various other methods. In addition to being consistent and simple,
this allows setting the base URL explicitly, regardless of the
environment.
- Default protocol-relative URLs to 'https' if no document location
(though I'm not sure if that ever happens)
1e0ad3aba changed the test for DB corruption to look for "database disk
image is malformed", but at least Sqlite.openConnection() can throw a
"Could not open connection" error with "2152857611"
(NS_ERROR_FILE_CORRUPTED) in it.
Fixes issues when integration plugin field appearance order
in the document is hard-linked and fields can be nested,
which breaks those links when updating a field with nested fields, in
the process removing the nested fields and upsetting document field
order.
Report: https://forums.zotero.org/discussion/83840/error-while-refreshing-a-large-document
Include flags in repo update checks indicating whether a database table
that was previously supposed to be removed was removed and whether a new
table was created. This should help us figure out whether we can safely
perform schema update steps or whether we need to figure out why some
schema update steps aren't being applied.
Possibly caused by a third-party client uploading mtimes that then
aren't synced, or that differ from what get synced. When we detect this,
try to correct it by updating mtimes on WebDAV and the API to match the
local file.
https://forums.zotero.org/discussion/83554/zotero-loop-syncs-2000-items
Show a popup if DB corruption is detected with a warning to avoid
storing the data directory in cloud storage, a link to a support page
with more information, and a button to restore from the last automatic
backup.
Also show the warning about cloud storage again after restoring from the
last automatic backup.
- Support Adobe Acrobat on macOS, with page number support via System
Events. Tested with Acrobat Reader, but hopefully functional with
non-Reader versions as well
- Use full path to configured .app via AppleScript rather than a
hard-coded name, in case there are multiple versions on the system
- Simplify code and improve logging
This seems like it would be sufficient for most tests that need to wait
for a page to load and is much less annoying in Scaffold. We could
adjust for automated runs if those end up using a browser again.
Previously, while updating a test used loadDocuments() (for a real
browser load) and honored `defer: true`, running a test did not.
This updates Zotero_TranslatorTester to use loadDocuments() when run in
Zotero. In other environments (translation-server, connector), it will
continue to use processDocuments(), which is based on XHR.
Fixeszotero/scaffold#96
Zotero.File.move() now forces `overwrite` if the old and new filenames
differ only by case, since otherwise on a case-insensitive filesystem
OS.File.move() does an existence check and thinks that the target file
exists.
Prior to fdfa8052d1, it was possible to create an item in a feed
library using Add Item by Identifier. If you did that, and then copied
it to a collection in your personal library, it would somehow end up
with an owl:sameAs relation to a `/users/local` URI (probably because
the URI functions don't work properly on a feed library).
This will clean up such relations in a schema update.
Most importantly, don't allow Add Item by Identifier to create an item
in a feed library...
The other buttons didn't do anything but still showed an effect on
mousedown, which this prevents.
If repo.zotero.org returned a 500 during Zotero startup, translators and
styles wouldn't be initialized until a 200 was returned, and various
things that depended on translators or styles wouldn't work in the
meantime. Now a single retry is made after 5 seconds, and if that fails
the promise is resolved regardless.
Regression from dc60e5f840, which added automatic 5xx retrying to
Zotero.HTTP.request()
Previously, if an object was uploaded but the API returned 'unchanged',
the uploaded data would be written to the sync cache, which, given that
most requests are patch requests, could result in an empty or mostly
empty object being saved to the sync cache. That would cause the next
sync to treat most/all local fields as changed and either upload them
unnecessarily or trigger a conflict instead of merging changes
automatically.
When non-conflicting changes were automatically merged, the local object
would be correctly marked as unsynced, but the merged object rather than
the remote object would be saved to the sync cache. When the object was
then uploaded, it matched the cache version exactly, so an empty patch
object (other than an unchanged dateModified, which is always included)
would be uploaded and the local change wouldn't make it to the server.
The empty patch would result in an 'unchanged' response, which would
cause the empty patch object to be saved to the sync cache (which is a
bug that I'll fix separately). If the local object was modified again,
the patch would include all fields (since the cache object was empty)
and the local change would be uploaded, but there could also be
unnecessary conflicts due to it looking like all local fields had been
modified.
This patch causes the remote object to be saved to the sync cache
instead, so the local change looks like a local edit and is correctly
uploaded.
Don't include linked-object or replaced-item relations. Previously, if
you duplicated an item, modified it to represent a different source, and
dragged it to another library where you had already copied the original
item, the new item wouldn't be transferred.
https://forums.zotero.org/discussion/comment/353246/#Comment_353246
Apparently we implemented this 5 years ago in #873 and then broke it
(with the move to React, I think) without ever announcing it as a new
feature in Zotero 5? Anyway, this restores it, using Cmd on macOS (the
same as for moving vs copying items, or files in Finder).
Since at least 2009, for reasons unclear, we've used `dialog=no` when
`instantApply` is true (macOS/Linux) and `modal` (with implicit
`dialog=yes`) when false (Windows). `dialog=no` doesn't seem to have an
effect on macOS, and `modal` doesn't seem to have an effect on Windows
(at least with `openDialog()`), but on Linux `dialog=no` allows the
dialog to be resized, which it shouldn't be, and causes problems with a
tiling window manager. This change switches to the implicit `dialog=yes`
on all platforms. (On Linux, this also centers the dialog on the screen,
keeps it in front of other windows, and does a weird opening animation.)
https://forums.zotero.org/discussion/82050/zotero-preferences-window-issue-with-tiling-window-managers
This should dramatically improve import speed for large imports by
delaying UI updates until the import finishes.
Additional Zotero.Attachments methods now support `saveOptions` to
support `notifierQueue`.
'podcast' is now the first mapped type for 'broadcast', per
https://forums.zotero.org/discussion/comment/351113/#Comment_351113, so
we need to check for fields not available in 'podcast'. 'radioBroadcast'
will be converted to 'tvBroadcast' on re-import, but that was the case
before.
- When changing type based on 'type:' line, move existing fields that
are no longer valid to Extra
- Remove 'type:' line with CSL type if the item's existing type is one
of the types mapped to it
getAllAddons() waits for extensions to be initialized, so the code in
Prefs::loadExtensionDefaults() to delete an extensions.json with an
AppTranslocation path should be sufficient, and it shouldn't be
necessary to check for it after showing the AppTranslocation startup
error.
If a Mac user first starts Zotero from the disk image, Zotero
shows an error telling them to install the app in Applications, but the
integration plugins will have already be registered in extensions.json
with paths to the temporary AppTranslocation directory. This meant that
the next time the user restarted their computer (or sooner), the AppTranslocation
directory would be cleared and the integration plugins would no longer
be loaded.
This deletes extensions.json if it contains an AppTranslocation path for
an extension when the app is started from the disk image, which should
prevent this going forward. For existing users experiencing this, it
also checks installed extensions at startup for AppTranslocation paths
and deletes extensions.json if any appear.
This shouldn't actually be used currently, since only notes and
attachments lack creators and it shouldn't be possible to change regular
items into notes or attachments.
81739c7a66 prevented new windows from working after a restart error,
and full-text tests (and possibly others) create attachments quickly in
a way that was causing init callbacks to receive a TinyMCE editor with
missing functions (possibly because they were already removed?). This
just ignores those errors, which isn't a great solution, but it probably
won't happen in real use, so let's see if it works.
It shouldn't be possible to nest two collections inside each other, but
if it happens, fix it in the integrity check.
Also detect it from CollectionTreeView::expandToCollection() (used when
showing the collections containing an item) and crash Zotero with a flag
to run an integrity check after restart. Previously, this would result
in an infinite loop.
This may be the cause of some of the collection disappearances people
have reported. If parentCollectionID never leads to a null, the
collection won't appear anywhere in the tree.
TODO:
- Figure out how this is happening
- Detect and fix it automatically for people it's happened to
If you'd never set a Quick Copy locale, the option would show as using
the current locale, but Quick Copy itself would use the last locale from
"Create Bibliography from Items". That was a side effect of behavior we
put in place in 2015 so that documents created before 4.0.27 that relied
on the removed bibliographyLocale pref would continue using the migrated
locale, but now that we've had an explicit locale option for years in
the document preferences I think we can stop doing that.
This prevents a second copy of Zotero from being launched if you're
running the Zotero beta and click on a word processor plugin button
while a dialog is already open.
Previously, files updated remotely wouldn't be downloaded in "as needed"
mode if a copy of the file already existed locally and could only be
re-downloaded by deleting the file via Show File.
This causes remotely modified files that exist locally to be downloaded
at sync time, even in "as needed" mode, by marking them as
"force_download". While this might not be ideal for people who use "as
needed" to limit data transfer, it's better for people who use it simply
to limit local storage, and ending up with an outdated file while
offline seems worse than a little bit of extra data transfer.
In the future, we'll likely also provide ways to explicitly download and
remove files, so keeping chosen files in sync makes sense.
Files modified remotely before this change (which were marked as
"to_download" instead of "force_download") won't be downloaded as sync
time in "as needed" mode, but they'll now be re-downloaded on open.
Fixes#1322
- Use full-text cache file from syncing if available when reindexing via
info pane or Rebuild Index → Index Unindexed Items. Only discard it for
full index rebuild. This allows Index Unindexed Items to be used to
force immediate processing of queued content from syncing and avoids
unnecessary syncing back of identical content. Previously, the cache
file was used for a manual index only when the local file didn't exist.
- When rebuilding index, don't clear indexed items with missing local
file that are missing stats due to a pre-411180ef bug.
- indexItems() now takes an 'options' object as its second parameter
- Minor code cleanup
- Don't clear item's index stats (and show "Unknown") when an item is
reindexed remotely and the content matches the local content
- Always update an item's state and its stats in the same query, to
avoid incorrect feedback immediately after indexing
- Clean up `setItemContent()` tests
This causes problems with filtered test runs, since the request is
cancelled and the long response gets dumped to the console, making the
test result hard to find.
This is a prerequisite for starting to use new fields in translators,
since otherwise switching from, say, storing originalDate in Extra to
using an originalDate field would cause the value to be lost in clients
without the newer schema.
Closes#1504
Follow-up to df40ee7216
- Restore opening of non-HTTP URL schemes in link attachments
- Remove scheme whitelist for link attachments, since it's not enforced
via the API anyway and we prompt before an external application is
opened. Instead, just block a few schemes (e.g., 'javascript') from
launching.
TODO:
- Provide some way to change/reset an application association if the
user checks the box to automatically open that scheme.
- Show an error message if a link attachment with an invalid URL is
double-clicked
E.g., show "Foo Bar" for field fooBar if not available
This could happen after downgrading if the global schema couldn't be
read from the DB for some reason.
- Support launching plausible HTTP URLs without schemes from
Zotero.loadURI(), and use that when launching from URL field
- Show correct cursor feedback on URL label -- only show pointer if the
URL is launchable
- Don't launch non-HTTP URLs (e.g., zotero://) from URL field
- Don't open HTTP URLs in viewer when using ZoteroPane.launchURI()
And switch to Unicode green checkmark and red prohibited characters on
all platforms, which fixes#1675.
The treecol checkmark stopped working on Windows in Fx60.