Commit graph

7649 commits

Author SHA1 Message Date
Adomas Venčkauskas
5798926093 Fix number inputs and adjust linux styling for the prefs pane 2020-12-21 12:20:17 +02:00
Dan Stillman
7a434df539 Disable creation of missing tables/indexes in Schema.integrityCheck()
Originally added in 5b9e6497a. We stopped running the integrity check
before userdata upgrades in c4cc44528 because this new behavior was
breaking upgrades, but it could still be run when coming from the DB
Repair Tool, which could cause problems if, say, you recovered a
database from a computer that had an older version of Zotero and ran the
DB Repair Tool on it. Disabling this for now until we have a better
solution.
2020-12-21 01:50:13 -05:00
Dan Stillman
43e6493997 Don't convert "Type: article" in Extra to Document item
CSL 1.0.2 clarified that type 'article' is meant for preprints and
working papers, so until we have a Preprint item type, just leave it in
Extra.

Discussion: https://github.com/zotero/translators/pull/2248#discussion_r492009958
2020-12-21 01:11:28 -05:00
Dan Stillman
aeceb67a07 Add Zotero.isBigSurOrLater, in case we need it later 2020-12-20 04:25:21 -05:00
Dan Stillman
e918b430b6 Fix Quick Format dialog appearance on Big Sur, and tweak on <=10.15
The Quick Format dialog's shape is based on the OS window corners, and
that changed on Big Sur, which resulted in whitespace along the bottom
edge and a misaligned search results box.

The tops of the citation bubbles were also cut off (at least for me) on
Catalina.
2020-12-20 04:23:38 -05:00
Fletcher Hazlehurst
0bb1588f22 Use Ace for Run JavaScript code editor
Closes #1928
2020-12-18 10:45:52 -07:00
Fletcher Hazlehurst
36d81e839c Use ace-builds NPM package 2020-12-18 10:45:38 -07:00
Dan Stillman
31c928a3ff Don't let invalid translators break all translation
If a translator couldn't be parsed, `_translatorInfo` wouldn't be set,
and that would somehow cause the translator info for subsequent
detections to be out of sync with the code loading, and nothing would
work. Putting a try/catch around the eval() allows subsequent
translators to continue to work normally. (There might be a better fix,
but this seems to work.)

This was happening for Better BibTeX translators that were still
installed without the extension (which they need to be parsed properly),
causing all imports to break.

https://forums.zotero.org/discussion/86613/error-id-1093166052-upload-of-ris-and-bibtex-data-failed
2020-12-10 03:58:17 -05:00
Dan Stillman
558ad20ce6 Scaffold: Improve cookie handling
- Use cookies from browser pane when running detectWeb or doWeb
- Use cookies from document when running or updating tests

This should fix various cases where translators can't be properly
developed or tested in Scaffold (e.g., [1]).

[1] https://github.com/zotero/translators/pull/2296#issuecomment-739116620
2020-12-06 03:09:13 -05:00
Dan Stillman
01646f1f8f Fix regression in 84730e610c
Only switch item types in fromJSON() if one was actually parsed out of
Extra
2020-11-27 18:04:03 -05:00
Dan Stillman
a249cd1608 Update citeproc-js to 1.4.50 2020-11-27 17:50:20 -05:00
Dan Stillman
84730e610c Don't delete valid item/CSL type from Type in Extra on sync
After a local item change, Zotero uploads the JSON and then applies the
saved JSON returned from the API to the local object using `fromJSON()`,
the same as it would apply any other remote change.

`fromJSON()` is meant to migrate Extra lines into real types and fields
after future item type/field changes. It calls
`Z.Utilities.Internal.extractExtraFields()`, which looks for valid item
type or CSL type values in Type lines in Extra, handles the rest of
parsing accordingly, and passes back the parsed item type. `fromJSON()`
wasn't handling `itemType` in the response object, so the item type
didn't get applied and the Type line was stripped. This fixes that.

Since valid type values are now parsed, if you have a Journal Article
item with a Pages field and enter "Type: song" into Extra and sync, the
item will be converted to Audio Recording and `Pages: 123` will be
placed in Extra.

https://forums.zotero.org/discussion/comment/369221/#Comment_369221
2020-11-27 17:50:20 -05:00
Adomas Venčkauskas
ddcbb47538 Fix number inputs and adjust linux styling for feed settings 2020-11-24 15:10:06 +02:00
Dan Stillman
c4cc44528c Fix error upgrading old databases after errors 5b9e6497af
Creating missing tables breaks schema update steps that assume those
tables don't exist, so we'll need another solution here. For now,
disable the automatic integrity check and make a couple recent schema
update steps more forgiving for people on the beta who already triggered
this.
2020-11-23 23:49:50 -05:00
Dan Stillman
75497e14c7 Item context menu: "Create Parent Item" → "Create Parent Item…"
Now that a dialog is displayed asking for further input

Follow-up to #1901
2020-11-20 16:35:29 -05:00
fletcherhaz
86b77cc45e
Add an option to create parent item from identifier (#1901) 2020-11-20 16:17:48 -05:00
Dan Stillman
07874d84bd
Merge pull request #1909 from fletcherhaz/snapshot
Update SingleFile for bug fixes
2020-11-17 16:02:13 -05:00
Dan Stillman
7c0cfd9420 Fix case of data dir not being created for new profile
If there was an existing ~/Zotero directory, another profile was already
pointing to it, and there was a Firefox profile pointing to a custom
data directory or with an embedded 'zotero' directory, the Firefox data
directory would be used instead of creating a new data directory named
after the new profile.

This skips the Firefox logic for new profiles when there's an existing
profile pointing at ~/Zotero and just creates the new data directory.
2020-11-17 15:57:16 -05:00
Dan Stillman
e575097e34 Missing line from 5b9e6497 to check schema integrity after crash 2020-11-17 01:26:46 -05:00
Dan Stillman
5b9e6497af Schema integrity check improvements
- 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().
2020-11-16 18:13:48 -05:00
Dan Stillman
6bcc8af86b Add Zotero.DB.columnExists(table, column) 2020-11-16 17:50:52 -05:00
Dan Stillman
b0e065a4ae Don't return relative path from .attachmentFilename for linked files
https://forums.zotero.org/discussion/86139/zotero-item-attachmentfilename-should-only-return-filename
2020-11-13 11:43:00 -05:00
Fletcher Hazlehurst
a72ae14816 Fix bug with double saving of snapshots. 2020-11-02 17:24:14 -07:00
Fletcher Hazlehurst
c0ec91f26d Fix bug for empty title when a translator does not provide one. 2020-11-02 17:24:14 -07:00
Fletcher Hazlehurst
a2620b757d Update SingleFile and fix several bugs
- 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
2020-11-02 17:24:14 -07:00
Dan Stillman
367fea1847 Zotero.File.copyDirectory(): Fix copying of subdirectories on Windows
This fixes copying of the previous extracted SingleFileZ snapshots
between libraries.
2020-11-01 18:51:55 -05:00
fletcherhaz
d16512c84f
Fix bug with async translate process never returning. (#1910)
When using `doImport` a promise is returned, but was lacking a catch a
statement to ensure completion.

This fixes #1882
2020-10-29 02:30:47 -04:00
Dan Stillman
2e2a4bca7f Follow automatic tags prefs when retrieving PDF metadata by ISBN
https://forums.zotero.org/discussion/85777/retrieve-metadata-for-pdf-creates-automatic-tags-even-when-pref-is-off
2020-10-27 01:27:57 -04:00
Dan Stillman
9fdf82aca5 Resolve relative attachment URLs with proxy: false
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
2020-10-26 23:29:40 -04:00
Dan Stillman
29f48476a9 Use UnexpectedStatusException in Zotero.HTTP.loadDocuments()
Follow-up to 76ae5d9f59, which changed loadDocuments() to pass/throw an
Error on a non-2xx response code
2020-10-24 00:04:01 -04:00
fletcherhaz
76ae5d9f59
Switch back to SingleFile from SingleFileZ (#1904)
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.
2020-10-23 19:39:07 -04:00
Dan Stillman
679a1acb90 Fix "Web Page" showing in New Item menu for new databases 2020-10-15 16:24:17 -04:00
Dan Stillman
e9afd153e9 Log HTTP error bodies when responseType is explicitly set to 'text'
Previously they were only logged if responseType wasn't set
2020-10-14 19:33:46 -04:00
Dan Stillman
828ec4010e Don't allow items to be set as their own parents, and correct existing 2020-10-14 19:33:46 -04:00
Dan Stillman
6b626ba992 Fix error in Mendeley import (regression from 8fc316f727)
"Zotero.Relations.getByPredicateAndObject(...).filter is not a function"
2020-10-13 16:45:31 -04:00
Fletcher Hazlehurst
bb0ddbd872 Fix server not handling empty body in multi-part request
An empty body is still valid. Was causing an issue for empty favicons.

https://forums.zotero.org/discussion/85600/bug-report-no-snapshot-in-zotero-beta
2020-10-12 15:06:11 -06:00
Dan Stillman
1ac79c0974
Merge pull request #1896 from fletcherhaz/snapshot
Fix CORS issues in SingleFile
2020-10-11 23:18:11 -04:00
Fletcher Hazlehurst
ed304b56e0 Remove crossorigin attributes in snapshots.
When loading a snapshot locally, same-origin of null will not load them
2020-10-11 18:19:41 -06:00
Fletcher Hazlehurst
dadc64e0d5 Extract SingleFile config so we can share with connector 2020-10-11 17:25:18 -06:00
Dan Stillman
479f01fa9c Fix in-client SingleFile saving on Windows
https://forums.zotero.org/discussion/85538/zotero-5-0-91-beta-not-saving-snapshots-d672469174
2020-10-08 18:44:50 -04:00
Dan Stillman
71550deb98 Fix URL resolving during translation in Zotero client
Regression in c0b6712923

The URL constructor isn't available in XPCOM.
2020-10-05 23:38:28 -04:00
Dan Stillman
d3c481fcf6 Fix bundled attr() when attribute doesn't exist
Regression from 4efc0af119
2020-10-05 23:36:06 -04:00
Dan Stillman
987b9ce4cb Fix zotero://open-pdf links with page for PDF Expert
https://forums.zotero.org/discussion/comment/365610/#Comment_365610
2020-10-04 18:05:03 -04:00
Dan Stillman
328865299b Add SingleFileZ to about window 2020-10-03 17:57:59 -04:00
Fletcher Hazlehurst
37cdba6f40 Clean up code from SingleFile error handling fix 2020-09-28 12:00:36 -07:00
Fletcher Hazlehurst
1c5cefaffd Fix handling of network errors for SingleFile save 2020-09-28 10:43:32 -07:00
Dan Stillman
20c8cede4d
Merge pull request #1846 from fletcherhaz/snapshot
Use SingleFile to create snapshots of web pages
2020-09-24 18:08:34 -04:00
Dan Stillman
cae2aab70f Reduce startup time from retraction key caching 2020-09-23 22:58:53 -04:00
Fletcher Hazlehurst
0fba08b3c9 Use SingleFile to create snapshots of web pages 2020-09-23 09:37:09 -07:00
Dan Stillman
693cd926d5 Apply subtitle capitalization to dependent styles based on parent
If a style specifies a style like APA that wants uppercase subtitles,
the dependent style should have them too.

https://forums.zotero.org/discussion/comment/364864/#Comment_364864
2020-09-22 17:07:40 -04:00
Dan Stillman
c5f01bc2f3 Make sure item returned from getLinkedItem() has all data loaded
Follow-up to 8fc316f727
2020-09-15 01:12:56 -04:00
Dan Stillman
4efc0af119 Translator sandbox: Update attr()/text() and add innerText()
- 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
2020-09-14 23:51:12 -04:00
Dan Stillman
8fc316f727 Fix potential error dragging to library that hasn't been loaded
https://forums.zotero.org/discussion/85136/unable-to-copy-items-between-libraries

Zotero.Relations.getByPredicateAndObject() is now async.
2020-09-14 23:49:22 -04:00
Tom Najdek
eff19923ef Parse creatorIndex string value as a number #1874
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.
2020-09-10 01:31:25 -04:00
Tom Najdek
02e4bdfdb0 Blur edited creator field prior to deletion #1874
Resolves an issue where when trying to remove creator, while it is being
edited, next creator is removed instead.
2020-09-10 01:31:25 -04:00
Dan Stillman
e40fff6a7d Limit corrupted-login-manager warning to once per minute 2020-09-10 01:18:58 -04:00
Dan Stillman
0e74a91f6b Fix parsing of SQL dates without seconds
Previously, "2020-09-09 23:33" would be treated as a multipart date,
with "23:33" left in the visible field and "d" showing in the indicator.
2020-09-09 23:37:02 -04:00
Dan Stillman
4ac35ecda3 Fix invalid HTML in note from Quick Copy
A <body> was included with the note element outside of it.
2020-09-09 23:36:18 -04:00
Dan Stillman
4838726b87 Throw invalid-data error on unknown attachment link mode in fromJSON() 2020-09-09 18:01:50 -04:00
Dan Stillman
c0b6712923 Utilities.Translate.resolveURL() tweaks
- 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)
2020-08-11 03:55:32 -04:00
Dan Stillman
8214c85bee Remove outdated comment after 8614e73aa8 2020-08-07 19:36:34 -04:00
Dan Stillman
8614e73aa8 Throw clearer error when 'storage' is a broken symlink
Instead of '(NS_ERROR_FILE_ALREADY_EXISTS) [nsIFile.create]', throw
"Broken symlink at <path>".

Closes #1834
2020-08-07 18:23:44 -04:00
Dan Stillman
7c201f5d59 Big Sur style fixes
- Restore active <tab> label
- Fix appearance of tabs in item pane
2020-07-28 00:15:11 -04:00
Dan Stillman
164701450c Limit schema diagnostics to dev builds 2020-07-22 18:38:42 -04:00
Dan Stillman
7f92220ef9 Restore detection of some types of DB corruption at startup
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.
2020-07-22 16:14:17 -04:00
Dan Stillman
785b6dd408 Update citeproc-js to 1.4.11
This fixes the "invalid language tag" error when there are invalid
language tags in Language (beta only).

https://forums.zotero.org/discussion/84224/zotero-error-refreshing-report-id-337976002
2020-07-18 19:21:36 -04:00
Dan Stillman
ab3a5ddbd8 Scaffold: Include mimeType: text/html for attachments in test output
The connector includes this, so the new CI translator test runner in
zotero/translators was showing erroneous mismatches.
2020-07-16 17:40:48 -04:00
Dan Stillman
c1a06a5dea Add reminder to keep CSL mappings in sync with connector 2020-07-14 18:39:55 -04:00
Dan Stillman
f923af4f31 Update citeproc-js to 1.4.7
Includes fixes for https://github.com/Juris-M/citeproc-js/issues/140
and https://forums.zotero.org/discussion/83567/uppercase-letter-problem-in-turkish
2020-07-14 09:39:05 -04:00
Dan Stillman
71af747df0 Fix unnecessary style updating at startup in timezones > UTC
https://forums.zotero.org/discussion/comment/360144/#Comment_360144
2020-07-12 04:53:29 -04:00
Adomas Venčkauskas
8e4ac40174 Decrease translator test timeout 2020-07-07 13:14:20 +03:00
Adomas Venčkauskas
19880e4ded Translator tester updates for running in CI 2020-07-07 12:21:10 +03:00
Adomas Venčkauskas
419953f478 Perform integration document updates in reverse order
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
2020-06-26 11:13:03 +03:00
Dan Stillman
381fad3681 Remove outdated comment in retraction code
We're already detecting retractions that were removed from the list, so
I don't think this applies anymore.
2020-06-25 20:53:20 -04:00
Dan Stillman
7422c50076 Fix detection of retractions for items with DOI in Extra
Affected items should be detected on the next retraction updates check
2020-06-25 20:53:20 -04:00
Adomas Venčkauskas
6bbb7ddc09 Ignore leading comma in citation dialog search. Closes #1839 2020-06-22 10:00:18 +03:00
Dan Stillman
1ec2615eee More debug info for incomplete schema upgrades
Include info on whether the data directory is in a cloud storage folder
and whether the DB passes a quick integrity check.
2020-06-21 05:24:42 -04:00
Dan Stillman
b4320fbc4c Add Zotero.DB.quickCheck(), and speed up integrityCheck()
https://www.sqlite.org/pragma.html#pragma_quick_check

And limit both checks to 1 error (e.g., integrity_check(1))
2020-06-21 05:21:48 -04:00
Dan Stillman
3e8f0af583 Schema upgrade debugging
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.
2020-06-21 03:08:03 -04:00
Adomas Venčkauskas
42ac976f1e Do not attempt to update bibliography when no citations are present 2020-06-18 16:13:47 +03:00
Dan Stillman
68ec841f35 Warn on "Box" in data directory path 2020-06-14 17:15:12 -04:00
Dan Stillman
bccf5ff0b2 Fix endless WebDAV loops if server has wrong mtimes but hash matches
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
2020-06-09 01:26:11 -04:00
Dan Stillman
a8c682bf4b Preserve linked-object and replaced-item relations when merging items
https://groups.google.com/d/msgid/zotero-dev/6f764822-ed7c-46eb-8068-ce9ed1a1538c%40googlegroups.com

Regression from 617564982c
2020-06-06 17:16:09 -04:00
Dan Stillman
bb220ad0f2 Update to citeproc-js 1.3.22 2020-06-02 17:07:31 -04:00
Dan Stillman
b2e902746a Strip HTML tags from titles when generating filenames 2020-06-02 17:06:42 -04:00
Dan Stillman
13349df380 strToDate(): More boring way of fixing 0620b16d3e 2020-05-28 06:38:39 -04:00
Dan Stillman
0620b16d3e strToDate(): Don't parse 01/01/08 as the year 8
Regression from b7dc0d8b0a (5.0.81)
2020-05-28 06:19:42 -04:00
Dan Stillman
c882488ef7 Add "(APA)" and "(ASA)" to style list in Document Preferences
Hopefully this will help people not select ASA 6th when they're looking
for APA 6th.

https://forums.zotero.org/discussion/comment/357135/#Comment_357135
2020-05-28 06:19:41 -04:00
Dan Stillman
b0fd7adcbe Ignore useDataDir pref if no dataDir pref 2020-05-28 04:35:14 -04:00
Dan Stillman
85bc5d168e strToDate(): Fix 'order' for just a number <=12
"m" instead of "m y"
2020-05-28 04:35:14 -04:00
Dan Stillman
f43df90225 Fix applying remote deletion of item in collection in read-only library
"Cannot edit item in read-only library"

I have no idea how this bug has gone undetected for so long.
2020-05-26 08:23:18 -04:00
Dan Stillman
b288a278d8 Warn if data directory is in iCloud Drive 2020-05-26 03:11:43 -04:00
Dan Stillman
c65322d0a4 Clarify warnings about data removal when switching accounts
And improve styling of hardConfirmationDialog.xul

Closes #1359
2020-05-23 03:23:32 -04:00
Dan Stillman
1e0ad3aba3 Restore corrupted-database detection during SQL queries
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.
2020-05-22 04:46:58 -04:00
Dan Stillman
30cefca18e Fix cross-library collection dragging from read-only library
This has apparently always been broken.
2020-05-20 08:45:37 -04:00
Dan Stillman
a086507167 Obey Cmd/Ctrl-W in Scaffold, Style Editor, and Run JavaScript windows 2020-05-17 04:08:43 -04:00
Dan Stillman
c9e90417ee Improve zotero://open-pdf handling
- 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
2020-05-16 02:04:16 -04:00
Dan Stillman
6676ece3e4 Add 'pcloud' to dangerous data directories
It seems like pCloud can sync arbitrary directories as well, but at
least some people use "pCloud Drive".
2020-05-15 19:26:24 -04:00
Dan Stillman
c5783f093a Add missing 'www' to support URL 2020-05-15 19:24:45 -04:00
Dan Stillman
2d720b9532 Scaffold: Clarify error parsing tests 2020-05-15 19:24:20 -04:00
Dan Stillman
2e50d37ebb Translator tester: reduce defer delay from 20s to 5s
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.
2020-05-15 19:21:40 -04:00
Dan Stillman
4068dffc0f Scaffold: Use loadDocuments() for tests and honor defer: true
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.

Fixes zotero/scaffold#96
2020-05-15 19:21:40 -04:00
Dan Stillman
0341b8e99a HTTP.loadDocuments(): Create cookie sandbox automatically if not provided
This prevents use of the internal cookie store.
2020-05-15 19:21:40 -04:00
Adomas Venčkauskas
d0db9cbadf Attempt to catch/log initialization errors for the citation dialog 2020-05-15 10:30:40 +03:00
Dan Stillman
6d2e843f50 Fix "params.join is not a function" in DB.queryAsync() error logging
If a query failed and `params` wasn't an array, the "params.join is not
a function" would be thrown rather than a proper error.
2020-05-12 03:50:43 -04:00
Dan Stillman
0199428c57 Fix error migrating Extra with empty author in citeproc-js cheater syntax
E.g., `{:author: }`

https://forums.zotero.org/discussion/83070/error-report-id-n-a-there-was-an-error-starting-zotero
2020-05-12 01:00:21 -04:00
Dan Stillman
849d52f1bb Update submodules 2020-05-09 03:20:53 -04:00
Dan Stillman
ac19cbbc40 Fix tag selector not showing child item tags in "Title, Creator, Year" mode
Regression from 5.0.83. This reverts 4290f26d7c.

https://forums.zotero.org/discussion/82564/tag-management
2020-05-03 20:07:14 -04:00
Dan Stillman
cece56af79 Warn when data directory is in Google Drive or OneDrive
In addition to Dropbox

There might be others we should add. (E.g., can we detect when
Desktop/Documents is in iCloud on a Mac?)

Closes #1373
2020-04-29 04:42:42 -04:00
Dan Stillman
7c3faeb58d Don't allow setting data dir to 'storage' or linked attachment base dir
If 'storage' (with a zotero.sqlite file above it) is chosen, offer to
use parent instead.

Addresses #538
2020-04-29 04:42:42 -04:00
Dan Stillman
40fe85b274 Prevent setting base directory within data directory
Addresses #538
2020-04-29 04:42:42 -04:00
Adomas Venčkauskas
30d40d6094 Add some temporary logging for Mac users getting empty citation dialog
https://forums.zotero.org/discussion/82697/empty-citation-dialog-after-clicking-add-edit-citation-on-an-existing-citation
2020-04-23 11:40:16 +03:00
Dan Stillman
2c046a227b Fix sync error on collection/search conflict
> Invalid data error for collection [key] in [library]: Unknown
> collection property 'dateAdded'"

Regression from 4b60c6ca27, probably
2020-04-23 03:56:14 -04:00
Dan Stillman
f531ac7b60 Fix error dialog display if attachment couldn't be renamed
Regression from 56dcd6da26 (2016)
2020-04-22 00:13:52 -04:00
Dan Stillman
53a1722a69 Throw explicit error if no type in itemFromCSLJSON() 2020-04-22 00:11:12 -04:00
Dan Stillman
81e2bee452 Fix 'false' filename after case-only rename on Macs
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.
2020-04-22 00:01:28 -04:00
Dan Stillman
595ba396ef Fix invalid relations from copying invalid feed item to collection
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.
2020-04-17 05:42:21 -04:00
Dan Stillman
fdfa8052d1 Disable toolbar buttons properly in read-only views
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.
2020-04-17 03:07:25 -04:00
Dan Stillman
e406e04f5c Resolve schemaUpdatePromise even if repository returns 500 at startup
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()
2020-04-17 02:11:27 -04:00
Dan Stillman
ad13313924 Don't change existing sync cache object on 'unchanged' response
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.
2020-04-14 05:07:50 -04:00
Dan Stillman
083588e211 Save correct data to cache when merging non-conflicting sync changes
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.
2020-04-13 03:42:28 -04:00
Dan Stillman
617564982c Include only related-item relations when duplicating items
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
2020-04-13 01:31:21 -04:00
Dan Stillman
c5a4871a6a Set freshwater-science to capitalize the first word of subtitles
https://forums.zotero.org/discussion/comment/352212/#Comment_352212
2020-04-13 01:31:06 -04:00
Dan Stillman
3d3c90215d Fix situation where all items list columns can become enabled 2020-04-10 15:56:37 -04:00
Dan Stillman
8a0e81d6f6 Properly require integrity check on nested collection detection
When expanding to a collection reveals an infinite loop

Bug in 0679809735
2020-04-09 02:17:37 -04:00
Dan Stillman
90b393ed79 Fix Shift-drag/Cmd-drag to tag selector to remove tags
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).
2020-04-08 03:58:10 -04:00
Dan Stillman
5bb2486040 Fix Shift-Tab in Title and Extra fields
Fixes #1806
2020-04-07 04:04:37 -04:00
Dan Stillman
ffa2a8d9be Don't crash when clicking on a note link with an unknown scheme 2020-04-06 04:52:37 -04:00
Dan Stillman
e9ea9ae171 Leave Event Place and Publisher Place in Extra on import
These CSL variables are both currently mapped to the Zotero Place field,
but that's imprecise and will change:

https://github.com/citation-style-language/zotero-bits/issues/6

So for now, don't convert these to a Place line or make them eligible
for migration to a real field (once we turn that on).

https://groups.google.com/d/msgid/zotero-dev/806a22e3-3d6a-4d86-8747-10c787291a93%40googlegroups.com
2020-04-04 04:17:51 -04:00
Dan Stillman
0e3d707576 Remove a couple redundant lines in Extra on RDF import
`publicationTitle`/`reporter` (and fields mapped to `publicationTitle`)
and `meetingName`/`conferenceName`

I assume these should just be base-field mappings, but since they're
not, they're not automatically deduplicated in `fromJSON()` and need to
be handled separately.

https://groups.google.com/d/msgid/zotero-dev/806a22e3-3d6a-4d86-8747-10c787291a93%40googlegroups.com
2020-04-04 04:17:27 -04:00
Dan Stillman
91ca6d2ba6 extraToCSL(): Fix "zoteroField[1] is undefined" on single-character field
E.g., "a:" on a line

https://forums.zotero.org/discussion/82286/new-line-in-extra-field-induces-error-during-bibliography-generation
2020-04-03 18:13:10 -04:00
Dan Stillman
c22b6ae68a Fix crash dragging open tag selector if closed at startup 2020-03-28 23:50:30 -04:00
Dan Stillman
97767278fb Load all item data types before migrating Extra fields on schema update
https://forums.zotero.org/discussion/82153/beta-startup-error
2020-03-27 02:00:28 -04:00
Dan Stillman
17d6181507 fromJSON(): Fix bug in 02c5510710 2020-03-24 18:25:53 -04:00
Dan Stillman
ad9604e267 Don't use 'dialog=no' or 'modal' for preferences window
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
2020-03-24 17:38:14 -04:00
Dan Stillman
0f212bdd76 Use modal dialog for import wizard and queue notifier updates
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`.
2020-03-24 16:02:17 -04:00
Dan Stillman
c62e725e2a Embed ids directly in Tags.getAllWithin() SQL to avoid parameter limit 2020-03-24 14:50:31 -04:00
Dan Stillman
679148d8d6 Don't store "Version Number" in Extra for books coming from RDF
The RDF translator assigns 'versionNumber' in addition to 'edition'.
2020-03-24 14:48:09 -04:00
Dan Stillman
02c5510710 Item.fromJSON(): Skip warnings for redundant invalid fields 2020-03-24 14:47:23 -04:00
Dan Stillman
0b7f5fef83 Re-enable Extra field migration on schema update 2020-03-24 14:13:21 -04:00
Dan Stillman
c03b9c2733 Leave ignored 'type:' in Extra (regression from 52d5b6856) 2020-03-23 19:06:49 -04:00
Dan Stillman
0278810cb5 Fix radioBroadcast/tvBroadcast CSL-JSON round-trip after 52d5b68564
'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.
2020-03-23 17:22:45 -04:00
Dan Stillman
48e39d9bd8 Update submodules 2020-03-23 16:25:48 -04:00
Dan Stillman
52d5b68564 Update 'type:' handling when migrating Extra lines
- 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
2020-03-22 15:19:24 -04:00
Dan Stillman
9d330206ed Remove unnecessary part of 58c2e38ec2
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.
2020-03-21 00:56:55 -04:00
Dan Stillman
58c2e38ec2 Fix invalid integration plugin installations on macOS
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.
2020-03-20 16:18:02 -04:00
Dan Stillman
e6453b2088 Parse single tab-delimited creator
And fix logged error when adding empty creator with just whitespace
2020-03-19 10:24:03 -04:00
Dan Stillman
c26ffedf9f Disable Extra field migration on schema upgrade for now
I enabled this by mistake in 3129f3580
2020-03-18 18:00:57 -04:00
Dan Stillman
8cd04e5d91 Temporarily disable the fix from 3247391914
Disable this until we figure out why it was running when migrating from
Extra.
2020-03-17 22:16:00 -04:00
Dan Stillman
3f2998bb6b Don't extract 'type: note' or 'type: attachment' from Extra 2020-03-17 13:50:45 -04:00