Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zotero links lost when copying notes #2981

Closed
AzedL opened this issue Sep 11, 2024 · 35 comments
Closed

Zotero links lost when copying notes #2981

AzedL opened this issue Sep 11, 2024 · 35 comments
Labels

Comments

@AzedL
Copy link

AzedL commented Sep 11, 2024

Debug log ID

9VDYTL46-apse/6.7.225-6

What happened?

When I use 'Ctrl+A' to select all and 'Ctrl+C' to copy a note, the text in the clipboard that I get via the 'text/plain' type usually contains zotero links at the end, which allows me to jump to the entry or note location in zotero.
They look like 'zotero://select/library/items/...' or 'zotero://open-pdf/library/items/...'.
However, starting with version 6.7.225, these links have been lost, leaving only the simple text.

Version 6.7.224 is correct.
Zotero 6 and zotero 7 get the same result.
Platform: win32 / x64 / 10.0.22631

@retorquere
Copy link
Owner

I cannot replicate the behavior that links are added at the end of a note, with or without better bibtex installed.

@AzedL
Copy link
Author

AzedL commented Sep 12, 2024

image
I am currently using zotero 7 and better bibtex v6.7.226.
When using 'Ctrl+C' to copy this note, the result obtained is: '“The idea we put forward in this paper is that the Öat money of a nation and other Öat claims may be seen as a close equivalent to the common stock of a corporation. At the simplest level, shares in a company just as units of Öat money, entitle the owner to a pro rata share of output. For a company, the output is proÖts net of interest expenses and taxes. For a nation, the output is real production of goods and services net of any foreign debt obligations. The goal of this paper is to formally model this analogy and thereby inform the determination of the optimal capital structure of nations.” (Bolton 和 Huang, p. 2)'.
But if better bibtex is disabled, the result will be: '“The idea we put forward in this paper is that the Öat money of a nation and other Öat claims may be seen as a close equivalent to the common stock of a corporation. At the simplest level, shares in a company just as units of Öat money, entitle the owner to a pro rata share of output. For a company, the output is proÖts net of interest expenses and taxes. For a nation, the output is real production of goods and services net of any foreign debt obligations. The goal of this paper is to formally model this analogy and thereby inform the determination of the optimal capital structure of nations.” ([Bolton 和 Huang, p. 2](zotero://select/library/items/QV3Q7553)) ([pdf](zotero://open-pdf/library/items/MGDHF43C?page=3&annotation=9R82BBYS))'.
PS: I replaced the brackets around the link to avoid it being recognized as a link by GitHub.

When using zotero 6 and better bibtex v6.7.224, results containing links are always obtained, regardless of whether better bibtex is enabled or not.
However, starting from v6.7.225, issues began to arise.
I am using the default zotero settings and have not used any plugins other than better bibtex.

@AzedL
Copy link
Author

AzedL commented Sep 12, 2024

image
I'm not sure if it's related to this setting, because whether the setting is modified or not, my friends and I always end up copying results that include the links.

@AzedL
Copy link
Author

AzedL commented Sep 12, 2024

The notes I copied were added via annotations, thus including citations at the end; I guess it might be related to this.

@retorquere
Copy link
Owner

Ah comments and annotations are different things in Zotero. Still, I have that setting enabled now, and if I have an annotated PDF open and press control-C (or Cmd-C on a mac), nothing ends up on the clipboard. No note or links. So I still don't know how to replicate what you have.

@AzedL
Copy link
Author

AzedL commented Sep 12, 2024

image
How about selecting and copying a highlight? I obtained the result: '“We thank the referees and Alex Edmans (the editor) for their detailed and very helpful comments. We are grateful to Yi Huang, Ye Li, Ailsa Roell, Tano Santos, Jose Scheinkman, Neng Wang and to seminar participants at the Graduate Institute Geneva, LSE, NYU, and PBoC for their comments. We thank Jieyun Wu and Wei Xiong for excellent research assistance. The views expressed in the paper are those of the authors and do not necessarily represent the views of CICC. The views expressed herein are those of the authors and do not necessarily reflect the views of the National Bureau of Economic Research.” ([[Bolton and Huang](zotero://select/library/items/QV3Q7553)](zotero://select/library/items/QV3Q7553)) ([[pdf](zotero://open-pdf/library/items/MGDHF43C?page=1&annotation=RWTZ9X4B)](zotero://open-pdf/library/items/MGDHF43C?page=1&annotation=RWTZ9X4B))', which also contains links.

@AzedL
Copy link
Author

AzedL commented Sep 12, 2024

image
I start with a new PDF, select a paragraph to create a highlight(or a annotation).
image
Then select the Notes.
image
Then choose to add a item note from annotation.
image
After that, you can get the note to be copied. My operation is to select all the text and copy it.

@AzedL
Copy link
Author

AzedL commented Sep 12, 2024

output.mp4

I hope this video is helpful.

@retorquere retorquere added bug and removed question labels Sep 16, 2024
@AzedL
Copy link
Author

AzedL commented Sep 17, 2024

Hey, any updates on this issue? Is there anything I can help with?

@retorquere
Copy link
Owner

I don't think so. I am just juggling a lot of work right now.

@AzedL
Copy link
Author

AzedL commented Sep 17, 2024

Alright, I can provide any details on this issue anytime you need them.

@retorquere
Copy link
Owner

I thought I had the links, but now I don't get them anymore. Can you do the following:

  • Disable Better BibTeX, then close zotero
  • Go into the Zotero folder in your home directory, inside that to the translators folder, en open Note Markdown.js in notepad
  • Change "lastUpdated": "2024-07-10 16:00:00" at the top into "lastUpdated": "2024-07-10 16:00:10"
  • Find the code
    if (annotation) {
      // annotation.uri was used before note-editor v4
      let uri = annotation.attachmentURI || annotation.uri;
      let position = annotation.position;

and add a line to make it this:

    if (annotation) {
      // annotation.uri was used before note-editor v4
      let uri = annotation.attachmentURI || annotation.uri;
      let position = annotation.position;
      Zotero.debug(`annotation: ${JSON.stringify(annotation)`)
  • start Zotero, reproduce the problem (you should get the links)
  • enable Better BibTeX, reproduce the problem (you should now not get the links)
  • send a new debug log.

@AzedL
Copy link
Author

AzedL commented Sep 19, 2024

I tried doing it this way, but even after I modified the file and restarted Zotero, I couldn't get the links anymore.
I changed "lastUpdated": "2024-07-11 09:05:00" to "lastUpdated": "2024-07-11 09:05:10", possibly due to a difference in time zones.
I have both Zotero 6 and Zotero 7 installed on my computer, but there's only one Zotero folder in the home directory. Could this cause any issues?

@AzedL
Copy link
Author

AzedL commented Sep 19, 2024

Ah, there's a syntax error in the code Zotero.debug(`annotation: ${JSON.stringify(annotation)`).
It should be Zotero.debug(`annotation: ${JSON.stringify(annotation)}`).

@AzedL
Copy link
Author

AzedL commented Sep 19, 2024

Debug log ID:
4BKLBVDW-apse/6.7.229-6
​W4BEQVI5-apse/6.7.229-7

I'm not certain whether the file I modified would impact Zotero 6 or Zotero 7, so I've sent logs for both. I'm unable to utilize version 6.7.231 as it seems to not be compatible with Zotero 6, and it consistently fails to appear on the plugin page for Zotero 7 (after restarting Zotero, I see no plugins on the plugin page, but I'm confident that I've installed and disabled BBT).

@retorquere
Copy link
Owner

I'm not certain whether the file I modified would impact Zotero 6 or Zotero 7

It impacts both

I'm unable to utilize version 6.7.231 as it seems to not be compatible with Zotero 6

It is fully compatible with Zotero 6, builds don't drop in issues unless they've passed my full test suite on 6, 7 and beta. If it doesn't work on 6 for you, please open a separate issue for that.

Can you send separate debug logs for the situation where the links work and where they don't? I don't see any difference between the objects logged in W4BEQVI5-apse. 4BKLBVDW-apse has errors because of the error you found and fixed in my snippet.

after restarting Zotero, I see no plugins on the plugin page, but I'm confident that I've installed and disabled BBT).

What happens if you install BBT again? I don't control what shows in the plugin page, so if it doesn't show there, Zotero is saying it isn't installed.

@retorquere
Copy link
Owner

Just to be sure, the way I've tried to reproduce this is:

  • add a note to a PDF attachment
  • extract this into a standalone note
  • copy the note contents and paste it somewhere

I should now be seeing links I think (I have the option on in the prefs) but I don't.

@AzedL
Copy link
Author

AzedL commented Sep 19, 2024

I tried to save and view Zotero's logs and found logs corresponding to different situations, which were exactly the same. I re-did the operations and checked the new logs, and they were indeed identical, but the results of the copy operation were indeed different. I noticed a detail that when BBT is disabled, for a short period immediately after starting Zotero, possibly 30 seconds, the copy result is the same as when BBT is enabled, with no links. After waiting for a while and copying again, the links were there.

@retorquere
Copy link
Owner

The thing is I'm not seeing the links even with BBT uninstalled and Zotero restarted.

@AzedL
Copy link
Author

AzedL commented Sep 19, 2024

New debug log ID:
GFAYIIPS-apse/6.7.231-7
ELRUJYMS-apse/6.7.231-7

I performed three copies without enabling BBT, and all results included links. After that, I enabled BBT and sent the first log.
Then I performed three more copies, and none of the results included links. Afterward, I sent the second log.

@AzedL
Copy link
Author

AzedL commented Sep 19, 2024

This is the result I got from copying shortly after Zotero started up, and it completely lacks the final citation.
“We thank the referees and Alex Edmans (the editor) for their detailed and very helpful comments. We are grateful to Yi Huang, Ye Li, Ailsa Roell, Tano Santos, Jose Scheinkman, Neng Wang and to seminar participants at the Graduate Institute Geneva, LSE, NYU, and PBoC for their comments. We thank Jieyun Wu and Wei Xiong for excellent research assistance. The views expressed in the paper are those of the authors and do not necessarily represent the views of CICC. The views expressed herein are those of the authors and do not necessarily reflect the views of the National Bureau of Economic Research.”

This is the result I got with BBT enabled:
“We thank the referees and Alex Edmans (the editor) for their detailed and very helpful comments. We are grateful to Yi Huang, Ye Li, Ailsa Roell, Tano Santos, Jose Scheinkman, Neng Wang and to seminar participants at the Graduate Institute Geneva, LSE, NYU, and PBoC for their comments. We thank Jieyun Wu and Wei Xiong for excellent research assistance. The views expressed in the paper are those of the authors and do not necessarily represent the views of CICC. The views expressed herein are those of the authors and do not necessarily reflect the views of the National Bureau of Economic Research.” (Bolton 和 Huang, p. 0)

This is the result I got with BBT disabled:
“We thank the referees and Alex Edmans (the editor) for their detailed and very helpful comments. We are grateful to Yi Huang, Ye Li, Ailsa Roell, Tano Santos, Jose Scheinkman, Neng Wang and to seminar participants at the Graduate Institute Geneva, LSE, NYU, and PBoC for their comments. We thank Jieyun Wu and Wei Xiong for excellent research assistance. The views expressed in the paper are those of the authors and do not necessarily represent the views of CICC. The views expressed herein are those of the authors and do not necessarily reflect the views of the National Bureau of Economic Research.” ([Bolton 和 Huang, p. 0](zotero://select/library/items/QV3Q7553)) ([pdf](zotero://open-pdf/library/items/MGDHF43C?page=1&annotation=RWTZ9X4B))

This is the result I obtained after removing the entire if code block that followed the newly added Zotero.debug line in Note Markdown.js. It appears that this if code block was responsible for adding only the second link.
“We thank the referees and Alex Edmans (the editor) for their detailed and very helpful comments. We are grateful to Yi Huang, Ye Li, Ailsa Roell, Tano Santos, Jose Scheinkman, Neng Wang and to seminar participants at the Graduate Institute Geneva, LSE, NYU, and PBoC for their comments. We thank Jieyun Wu and Wei Xiong for excellent research assistance. The views expressed in the paper are those of the authors and do not necessarily represent the views of CICC. The views expressed herein are those of the authors and do not necessarily reflect the views of the National Bureau of Economic Research.” ([Bolton 和 Huang, p. 0](zotero://select/library/items/QV3Q7553))

@AzedL
Copy link
Author

AzedL commented Sep 19, 2024

What happens if you install BBT again? I don't control what shows in the plugin page, so if it doesn't show there, Zotero is saying it isn't installed.

I reinstalled version 6.7.231 of BBT, and the issue did not reoccur.

@AzedL
Copy link
Author

AzedL commented Sep 19, 2024

image
After I changed this to false, I stopped getting links altogether, no matter what the settings were. It was true before I made the change.

image
The first link seems to be added by this part here.

@AzedL
Copy link
Author

AzedL commented Sep 19, 2024

Here with me, completely removing those two sections of code that add links or changing includeAppLinks to false will make the links disappear.
Are there any differences between the annotation you obtained from the logs and the annotation in the logs I submitted? The url used for judgment might be different, leading to not entering the if block or Zotero.getOption("includeAppLinks") being false? It's possible that this is the key to obtaining the links.

@retorquere
Copy link
Owner

I'm finding it hard to follow where we stand on diagnosis. The parts you pointed out are indeed responsible for generating the links and I'm trying to find out what effect BBT has on the conditions that trigger that code to be ran. Right now I don't have a clear picture of what you changed.

After I changed this to false, I stopped getting links altogether, no matter what the settings were.

Please don't do this. It adds variability we don't need. We want very targeted changes for diagnosis, and I need to know what code is running on your end when I can't replicate it locally.

I reinstalled version 6.7.231 of BBT, and the issue did not reoccur.

As in installing 6.7.231 fixes the problem for you? I don't follow. You were reporting the problem on .231.

I performed three copies without enabling BBT, and all results included links. After that, I enabled BBT and sent the first log. Then I performed three more copies, and none of the results included links. Afterward, I sent the second log.

There's no relevant difference there. Can you make the following changes:

  • Change "lastUpdated": "2024-07-10 16:00:00" at the top into "lastUpdated": "2024-07-10 16:00:20"
  • Change the debug line into
Zotero.debug(`includeAppLinks: ${Zotero.getOption("includeAppLinks")}, uri: ${typeof uri}, position: ${typeof position}`)

and generate a new log (only for the error condition, no need to disable BBT). No other changes to the translator please -- in fact it'd help if you would first go into Preferences, advanced, reset translators, and after that quit Zotero and make these two changes, then run the test.

@AzedL
Copy link
Author

AzedL commented Sep 19, 2024

New debug log ID:
8S7AALUS-apse/6.7.231-7

You're right. I reset translators before submitting this log.

@AzedL
Copy link
Author

AzedL commented Sep 19, 2024

image
By the way, here are the log for the correct condition.

@retorquere
Copy link
Owner

A build will drop here shortly, please reproduce on that and send a new log.

Copy link

🤖 this is your friendly neighborhood build bot announcing test build 6.7.232.7032 ("temp disable 1827")

This update may name other issues, but the build just dropped here is for you; it just means problems already fixed in other issues have been folded into the work we are doing here. Install in Zotero by downloading test build 6.7.232.7032, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

@AzedL
Copy link
Author

AzedL commented Sep 20, 2024

Debug log ID:
ZICHPEK5-apse/6.7.232.7032-7

The copy result includes links with this version.

Copy link

🤖 this is your friendly neighborhood build bot announcing test build 6.7.232.7038 ("immediately exit patch for non-BBT translators")

This update may name other issues, but the build just dropped here is for you; it just means problems already fixed in other issues have been folded into the work we are doing here. Install in Zotero by downloading test build 6.7.232.7038, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

@AzedL
Copy link
Author

AzedL commented Sep 20, 2024

Debug log ID for new build:
UJD8NQX4-apse/6.7.232.7038-7

The result includes links.

@retorquere
Copy link
Owner

So, fixed? That's what the log seems to indicate. If so, I'm rolling it out to release.

@AzedL
Copy link
Author

AzedL commented Sep 20, 2024

Yeah, I think it's fixed now.

retorquere added a commit that referenced this issue Sep 20, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants