jlegewie / zotfile

Zotero plugin to manage your attachments: automatically rename, move, and attach PDFs (or other files) to Zotero items, sync PDFs from your Zotero library to your (mobile) PDF reader (e.g. an iPad, Android tablet, etc.), and extract PDF annotations.
3.98k stars 281 forks source link

Zotfile does not function well with better-bibtex #307

Open qyin opened 7 years ago

qyin commented 7 years ago

As reported in retorquere/zotero-better-bibtex#742, the "send to/get from tablet" function dose not work well when better-bibtex is enabled.

When better-bibtex is enabled, I can still use the "send to tablet" function to send an attachment a predefined place. But the file will not be updated with a tag "_tablet" as expected. As a result, the "get from tablet" function is not applicable if I want to get the updated version from the predefined place.

Zotero version: 5.0.21 Better-bibtex version: 5.0.26 Zotfile version: 5.0.4

retorquere commented 7 years ago

I'm getting the error even sooner -- send to tablet doesn't work for me, but I really don't know why. I'm getting Exception... "Unexpected error" in the logs for this line, but BBT doesn't touch DOMParser, so it must be fallout damage from something else.

qyin commented 7 years ago

Hi @retorquere,

Report ID: CGBC2WX4.

retorquere commented 7 years ago

Same error:

[JavaScript Error: "[Exception... "Unexpected error"  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: chrome://zotfile/content/tablet.js :: Zotero.ZotFile.Tablet</this.addInfo< :: line 165"  data: no]" {file: "chrome://zotfile/content/tablet.js" line: 165}]

@qyin are you OK with me posting the logs so @jlegewie can see it? I don't see anything in the logs that strikes me as sensitive.

qyin commented 7 years ago

@retorquere Sure.

retorquere commented 7 years ago

log @ https://gist.github.com/6d41afac30c9dae2f240d9dc46a2d680

retorquere commented 7 years ago

I have no idea how BBT being installed triggers the issue, but according to this Firefox documentation, extensions should not use DOMParser but nsiDOMParser.

jlegewie commented 7 years ago

Can someone try with the most recent version on GitHub. I haven't tested this thoroughly but I changed from DOMParser to nsiDOMParser.

retorquere commented 7 years ago

I don't see a new version in the releases?

jlegewie commented 7 years ago

Not under releases. Development version from the master branch....

retorquere commented 7 years ago

Do you have a direct link?

jlegewie commented 7 years ago

https://github.com/jlegewie/zotfile (see instructions under "development version")

retorquere commented 7 years ago

If you add the contents quoted below to a file called .travis.yml in the root of your repo (and enable the project on http://travis-ci.org), every commit you do will auto-publish the master to https://anonfile.com. In the travis build log you'll find the exact URL the build is published to (example). This should make it easier for testers to pick up test builds (and make sure they're using the same build as you).

No particular reason to use anonfile but it just has the easiest API to use for file sharing.

language: node_js
script: make
after_success:
  - mv *.xpi zotfile-build-$TRAVIS_BUILD_NUMBER.xpi
  - curl -F "file=@zotfile-build-$TRAVIS_BUILD_NUMBER.xpi" https://anonfile.com/api/upload
qyin commented 7 years ago

@jlegewie I have tested the latest commit.

The "sent to tablet" function works well, i.e, the file was send to the desired place and the tag was updated with "_table". The problem is when use the "get from tablet" function, it fails with a warning said "the tablet file *.pdf was manually moved and dose not exist.

retorquere commented 7 years ago

Not sure whether it's related, but whenever I click one of the searcher I get a popup saying

The information stored in attachment notes is missing for an attachment on the tablet...

When I click get from tablet I also get the tablet file *.pdf was manually moved and does not exist.

You still have instances of parser = new DOMParser in metadata.js and tablet.js. I changed those in tablet.js to nsiDOMParser and then it seemed to work for me.

Still no idea why new DOMParser worked when BBT was not installed.

jlegewie commented 7 years ago

Thanks. I made the change in tablet.js. Not in metadata.js though because that is part of pdf.js, which is bundled with zotfile. I already make changes to their code but want to keep that at a minimum. So I will only do that if you guys also run into problems with the extraction of annotations.

So can someone test with the latest version works and solves the problem?

@retorquere: Thanks for the travis code. I will open a separate issue about that and follow up.

retorquere commented 7 years ago

It did when I made the changes to tablet.js, but it's more useful to get @qyin (and others in other issues that experience the same problem) to test as they're active zotfile users.

jlegewie commented 7 years ago

The test version is available here: https://anonfile.com/hdX09dcdb2 I will release this when someone else can confirm that it works...

manuelhubacher commented 7 years ago

Just tested ZotFile 5.0.5 together with Better Bib(La)Tex 5.0.28. The "send to/get from tablet" seems to work now. Thanks a lot!

But the issue with the unwanted subfolders remains (see #306).

qyin commented 7 years ago

@jlegewie thanks for the update. Yes, the "send to/get from tablet" seems works now.

A problem is that, I have to apply two times of "get from tablet" to make it work as expected. The first time is get the file from tablet, i.e. remove the file from a predefined place. At this moment, the pdf file still has the "_tablet" tag, I have to apply "get from tablet" again to remove the "_tablet" tag.

jlegewie commented 7 years ago

Are you sure that the tag is not removed the first time? Sometime the UI doesn't update immediately. You can check by changing to a different item and then back to the one that you just got from the tablet.

Otherwise, I would need a more detailed error report.

qyin commented 7 years ago

Yes. I am sure. I also tried restart zotero and the tag was still there.

I think this has something to do with tablet.mode. If I set extensions.zotifile.tablet.mode to "2", the above will happen definitely. But if I use the default value "1", then everything works as expected.