Commit graph

11740 commits

Author SHA1 Message Date
Adomas Ven
cd856efef8
Connector attachment saving server changes for 7.0 (#5345) 2025-06-19 01:01:52 -04:00
Abe Jellinek
1dad1ae0f8 Accept length-7 sortIndexes for snapshots (#5209) 2025-06-11 09:58:55 -04:00
Dan Stillman
bbf4692b99 Don't log entire byte array when downloading files 2025-03-15 23:07:17 -04:00
Dan Stillman
56f182f816 Fix file downloads timing out after 30 seconds
We switched file downloads to use XHR to fix downloads failing via
authenticated proxies in fx115+, but that made them subject to our
default 30-second timeout in `Zotero.HTTP.request()`. That timeout uses
the XHR `timeout` property, which applies to the whole request, even if
data is actively being downloaded. As a result, file downloads would
fail for people downloading large files or on very slow connections.

This implements manual connect and inactivity timeouts when using
`Zotero.HTTP.download()`. Currently, these both use `options.timeout`,
or the default 30 seconds, but we could probably take separate options
and have lower defaults now that they no longer apply to the whole
request.
2025-03-15 22:54:35 -04:00
Dan Stillman
601358f24b Fix very slow purging of itemDataValues at startup in large databases
When an item is erased (removed from the trash or cleaned up from a
feed), we set a flag to purge values in `itemDataValues` on the next
startup, with this query:

DELETE FROM itemDataValues WHERE valueID NOT IN (SELECT valueID FROM itemData);

For some people, that query was incredibly slow and would result in
Zotero intermittently hanging on "Loading items…" for a long time at
startup. It's possible this is mostly limited to people who subscribe to
high-volume feeds and have a lot of item churn. One affected person had
>900K values in `itemDataValues` despite having only 20K items.

It turns out the slow query is due to the foreign-key constraint on
`itemData(valueID)` that references`itemDataValues(valueID)`. SQLite is
checking every row being deleted from `itemDataValues` against
`itemData`, even though the query is specifically removing rows that
don't exist in `itemData`! For the 900K-value DB, disabling foreign-key
checks causes the `DELETE` query to take 25 seconds instead of...some
much longer time that I didn't wait for.

We already had an `executeTransaction()` flag, `disableForeignKeys`, to
temporarily disable foreign-key checks, but it didn't do so in a way
that was safe for post-initialization usage -- a write query outside of
a transaction could've run between the transaction commit and
foreign-key checks being re-enabled. This commit changes it to properly
block all other queries unless they include an `ignoreDBLock` option,
meaning that queries within the function passed to the transaction need
to include that option. (And since that's not realistic for the couple
other uses of `disableForeignKeys` -- one for a test and one in code
that almost certainly hasn't been run by anyone in 15 years -- those now
just run `PRAGMA foreign_keys=OFF|ON` explicitly, leaving this as the
only current use.)
2025-03-12 23:25:32 -04:00
PChemGuy
f4b531e657 Sort strings naturally or alphabetically (#5075)
Hidden setting. If true, use natural collection sorting matching the current behavior. If false, use conventional alphabetic sorting.
2025-03-12 23:25:32 -04:00
Abe Jellinek
096cc2e27b renderItemTitle(): Create <span> when inverting style
Creating an <i> with a style attribute that *removes* italics is just
too confusing.
2025-03-12 23:25:32 -04:00
Abe Jellinek
5ae1986f79 renderItemTitle(): Fix nested tag handling when rendering to string
Need to exit the loop regardless of whether we're rendering actual
nodes.

Fixes #5082
2025-03-12 23:25:32 -04:00
abaevbog
b250aed79d always trim editableText from itemBox on blur (#5081)
So that whitespaces are removed even if the itemBox
does not refresh.

Fixes: #5080
2025-03-12 23:25:32 -04:00
Dan Stillman
0542010659 Fix Zotero.HTTP.download() for fx115
Blob#bytes() was introduced in fx128.
2025-03-12 23:25:31 -04:00
Dan Stillman
4b78b2c130 Replace Zotero.Utilities.Internal.saveURI() with Zotero.HTTP.download()
Adds a new function, Zotero.HTTP.download(), that uses
Zotero.HTTP.request(). This fixes downloads via authenticated proxies in
Zotero 7 and gives us other request() functionality (e.g., 5xx retrying)
for free.

The downside is that this is probably less efficient, potentially
loading large downloads in memory. We should create a replacement for
request() based on fetch() that supports getting the body as a
ReadableStream.

Fixes #5062
2025-03-12 23:09:47 -04:00
Adomas Venčkauskas
051280fc43 Update ScienceDirect cf captcha selector 2025-02-19 02:03:27 -05:00
Abe Jellinek
264f55545a Fix faulty siblings-of-type check in setAutoAttachmentTitle() (#5045) 2025-02-19 02:03:26 -05:00
Dan Stillman
184671f919 Fix sync not downloading queued objects on first sync of session
`firstInSession` wasn't being properly set, so previously failed data
objects weren't being retried until a manual sync. Local files also
weren't being scanned for changes for three hours, but that's probably
better in the age of DB-stored annotations, so leave that off for now
and address properly in #5025.
2025-02-19 02:03:26 -05:00
Dan Stillman
24c7f146b3 Don't open new copies of runJS/scaffold/csledit
Possible we'll get complaints about no longer being able to open
multiple copies of at least runJS and csledit, and we can reconsider if
so, but reopening the existing window is certainly the intended
behavior.
2025-02-19 02:03:26 -05:00
Abe Jellinek
707c71506f Check editability based on tab when adding attachments (#4936)
And make `get[Selected/Sorted]Items()` and `canEdit[Library/Files]()` tab-aware
2025-02-19 02:03:26 -05:00
Abe Jellinek
569bd1ffae Item box: Fix missing Copy/Paste menuitems on URL fields (#5001) 2025-02-19 02:03:26 -05:00
Dan Stillman
62d46d337a Fix selectItems() not selecting non-top-level item in trash
https://forums.zotero.org/discussion/comment/484380/#Comment_484380

Adds `Zotero.Item#isInTrash()` that returns true if the item or any of
its ancestors is in the trash (i.e., `.deleted == true`)
2025-02-19 02:03:26 -05:00
Dan Stillman
ce0f7c0378 Use commas in file size in over-quota error 2025-02-19 02:03:25 -05:00
Dan Stillman
b4bf86915b Item#fromJSON(): Don't process any Extra rows in strict mode
And enable migration of Extra rows to valid fields in non-strict mode,
but since that's only used by translators now, that probably won't do
anything

Fixes #3422
2025-02-19 02:03:25 -05:00
Dan Stillman
8804effba4 Don't auto-select item after sync on upload error
Bug from 2017
2025-02-19 02:03:25 -05:00
Abe Jellinek
006a787272 Add key to Advanced Search menuitem
Fixes #4978
2025-02-19 02:03:25 -05:00
Dan Stillman
0424faee42 Unset Mozilla environment variables when launching files and URLs (#4983)
Fixes #4981
2025-02-19 02:03:25 -05:00
windingwind
3c9dcc94bc Fix attachments box race condition (#4997)
fix: #4611
Since the attachment preview already has a task queue,
don't skip render calls when rendering
2025-02-19 02:03:24 -05:00
Adomas Venčkauskas
4bc61273a0 Fix integration session breaking when an error is thrown during getDocument() 2025-02-19 02:03:24 -05:00
windingwind
59b3268d01 Fix dense call to setItemDownloadPercentage freezes app (#4979) 2025-02-19 02:03:24 -05:00
Dan Stillman
ddb1daabbc Fix json[c.field] is undefined sync error
Fix error if local note or attachment is added to a parent item while
the remote version was added to a collection. Now, the new local parent
item will be added to any collections the remote child item was added
to.

Fixes #2934
2025-02-19 02:03:24 -05:00
Tom Najdek
d0debc0bed Fix Metadata Retrieval to correctly display the recognized item's title 2025-02-19 02:03:24 -05:00
Adomas Venčkauskas
b5b59062a7 Refresh document with delayed citation updates when changing style
Closes #4974
2025-02-19 02:03:24 -05:00
windingwind
f7b4cf907b Fix export error of item.tags being undefined (#4962)
Item generated from embedded image attachment may not have attribute `tags`.
2025-02-19 02:03:23 -05:00
abaevbog
36838e6a9a qf: default arrowUp handling on locator menulist (#4965)
Do not close details panel on arrowUp when locator
type menulist is focused to allow for default handling
(e.g. select the next/previous option on windows).

Fixes: #4953
2025-02-19 02:03:23 -05:00
abaevbog
5b427ac332 save tagsBox updates when another item is selected (#4945)
When tagsBox item is changed by clicking on an itemTree row,
the blur even never fires on the currently focused tag. So
whatever changes were made will be discarded. To avoid it,
blur any opened tag rows (which triggers a saveTx)
when an item is being set, same way it is done in itemBox.

Also, a small tweak to properly fetch the focused tag
via editable-text:focus-within selector, since editable-text:focus is
always empty because the focus is on the input inside of
editable-text.

Fixes: #4942
2025-02-19 02:03:23 -05:00
abaevbog
65c77ddaae hide switch creator type in non-editable itembox (#4940)
Fixes: #4937
2025-02-19 02:03:23 -05:00
Dan Stillman
09813be7e0 Fix handling of redirecting OpenURL base URLs with url query parameter
For a URL like
`https://ezproxy.school.edu/login?url=http://resolver.ebscohost.com/openurl`,
without a trailing `?`, we were just adding a `%` to the end, making the
URL invalid after the redirection (`/openurl&url_ver=Z39.88-2004`
instead of `/openurl?url_ver=Z39.88-2004`).

(And apparently no one who sent in these URLs actually tested them
in-app?)
2025-02-19 02:03:22 -05:00
Abe Jellinek
85b111de4a Serialize _ensureFeedAbstractBrowserExists()
Prevent a potential race condition.
2025-02-19 02:03:22 -05:00
Martynas Bagdonas
e3ae991bb3 Render ink annotation images when previewing attachment annotations 2025-02-19 02:03:22 -05:00
Abe Jellinek
06fe4ad346 CookieSandbox: Fix XHR interface check
Actually broken since fx115.
2025-02-19 02:03:22 -05:00
windingwind
2019ac39a1 Fix ZoteroPane#buildFieldTransformMenu document variable (#4927)
fix: https://groups.google.com/g/zotero-dev/c/FwfrxviKi8I
2025-02-19 02:03:21 -05:00
Dan Stillman
02b48318d7 Update locales from Transifex 2025-02-19 02:03:21 -05:00
abaevbog
1321447374 let Zotero_Tabs.undoClose reopen duplicate tabs (#4920)
Fixes: #4919
2025-02-19 02:03:21 -05:00
Tom Najdek
c0c00752e7 Improve importing from Mendeley
- Make the annotations importer more resilient to missing data
- Fix notebooks not being imported in some cases
- Fix an instance of a hidden browser leaked by the Mendeley Importer
2025-02-19 02:03:21 -05:00
Dan Stillman
b9d1f50559 Remove debug line 2025-02-19 02:03:20 -05:00
Dan Stillman
77bdb0b4cb Shower nicer error for malformed WebDAV URL
We fix `://` or `//` automatically after #3483, but a leading ':'
character would still show an internal `NS_ERROR_MALFORMED_URI` error.
Instead, just say "[url] is not a valid WebDAV URL".
2025-02-19 02:03:20 -05:00
Dan Stillman
320399dca9 Strip leading :// or // in WebDAV URL
Closes #3483
2025-02-19 02:03:20 -05:00
Dan Stillman
8c54b98483 Reset file sync history when changing WebDAV URL
Fixes #3535
2025-02-19 02:03:20 -05:00
Dan Stillman
a0009f0fa3 Clear library storage version when resetting file sync history
Fixes #1753
2025-02-19 02:03:20 -05:00
windingwind
cb0b2f9d58 Item pane scroll pos fix after switching from note (#4897)
Follow up to #4879
fix: #4276
2025-02-19 02:03:20 -05:00
Abe Jellinek
886dbd17ff Abstract box: Use focused getter instead of :focus-within
See b4c5c5d539

Fixes #4878
2024-12-05 14:39:27 -05:00
Dan Stillman
6740115cf2 Revert "Fix Item Pane unstable rendering during scrolling (#4879)"
Regressions:

https://forums.zotero.org/discussion/120216/blinking-item-pane-when-switching-item-with-pinned-section-in-the-sidenav
https://forums.zotero.org/discussion/120217/title-field-is-not-visible-anymore-after-creating-a-new-item-if-a-section-is-pinned-in-the-sidenav

This reverts commit 4067745c7a.
2024-12-04 01:35:04 -05:00
Martynas Bagdonas
8317f77837 Trigger annotation import only for PDF attachments when creating a note
Fixes https://forums.zotero.org/discussion/120181/batch-create-note-from-annotations-for-different-attachment-types
2024-12-03 21:24:37 +00:00