edtechhub / zotero-edtechhub

https://github.com/edtechhub/zotero-edtechhub/projects/4
12 stars 3 forks source link

Duplicating attachments by right-clicking on attachment and selecting "duplicate attachment". #10

Closed bjohas closed 5 years ago

bjohas commented 5 years ago

https://github.com/zotero/zotero/issues/1626

A string would need to be added to the duplicate: "-copy-"+date", e.g. "-copy-20190721" before the ".pdf" (or whatever type the attachment is) to indicate that it's a newer version. I.e.

somestring.pdf

if copied today would change to

somestring-copy-20190721.pdf

I don't know whether the plugin has got access to the user name? In that case it would be even better if the string was "-copy-"+user+date, i.e.

somestring-copy-bjohas-20190721.pdf

retorquere commented 5 years ago

It does have access to the username, but I thought you wanted this as a change on zotfile?

bjohas commented 5 years ago

No - it's not related to ZotFile. I'll add to the project kanban regarding the zotfile change (whcih I think is no longer needed, as I'll explain). Link to card with explanation here: https://github.com/retorquere/zotero-edtechhub/projects/1#card-24470472

bjohas commented 5 years ago

I have a slightly amended request.

somestring.pdf

should change to

somestring-bjohas-20190721-{ID}.pdf

where {ID} is the first part of archiveLocation. I.e. if archiveLocation is A;B;C;D, then {ID}=sanitised(A), where 'sanitised' replaces '/' and ':' (and other characters that should not be in filenames) with '_'. So e.g. if

archiveLocation = 10/d254jm;2339240:NDCLGGGP

then the file becomes

somestring-bjohas-20190721-10_d254jm.pdf

If archiveLocation is empty, then could there let's just use

somestring-bjohas-20190721-__NO_AL__.pdf

(If it's easy to do a popup, then there could be a warning too, but that's really not necessary if it counts as UI.)

(I've also omitted 'copy' as it's pretty clear that we're dealing with a copy)

bjohas commented 5 years ago

Rationale: This creates a copy, that can be used as a copy, but also bakes in the archiveLocation. THis means the PDF can now be used outside Zotero (e.g. in analysis software) without losing the reference to Zotero.

blip-bloop commented 5 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.13.46 ("fixes #10")

Install in Zotero by downloading test build 0.0.13.46, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

retorquere commented 5 years ago

this currently only works for linked and imported files. Snapshots (imported URLs) are considerably more work and don't fit the use-case anyhow it seems to me.

bjohas commented 5 years ago

Totally fine - our use-case is just to duplicate imported files. Linked files are great too. Snapshots not necessary.

bjohas commented 5 years ago

Have tested - works well!

10/d254jm becomes 10d254jm but should become 10_d254jm.

retorquere commented 5 years ago

Should I remove linked?

bjohas commented 5 years ago

You mean remove linked files? No, I can see that being useful to people. So if it's working, then leave it in!

blip-bloop commented 5 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.13.47 ("fixes #10")

Install in Zotero by downloading test build 0.0.13.47, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

retorquere commented 5 years ago

10/d254jm becomes 10d254jm but should become 10_d254jm.

This should be fixed in .47

bjohas commented 5 years ago

Many thanks! I cannot see the option to duplicate the attachment any more. Why might that be?

bjohas commented 5 years ago

Hold on - it seems to work on some files, but not all... Hmm...

Can I add you to a library to illustrate the problem?

Can you request access to this library via Zotero? https://www.zotero.org/groups/2339240/edtechhub

retorquere commented 5 years ago

How large is this library?

blip-bloop commented 5 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.13.48 ("logging for file dup")

Install in Zotero by downloading test build 0.0.13.48, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

retorquere commented 5 years ago

Can you

  1. Install .48
  2. Go into Help - Debug Output Logging - Restart with Logging Enabled...
  3. Let Zotero restart
  4. Replicate the problem
  5. Go into Help - Send EdTech hub debug log
  6. Post the ID you get in the popup that follows
bjohas commented 5 years ago

OK, let me do that!

bjohas commented 5 years ago

Debug Output dup.txt

bjohas commented 5 years ago

In this output, the first right click was not successful Ii.e. didn't give the option to duplicate). The 2nd right click (on another item) was successfu. (i.e. it did give the option to duplicate). As far as I can tell, both items are 'similar' - same type, one PDF attachment (not a link)...

retorquere commented 5 years ago

Of the first, it says it's an imported URL (which I though was a website snapshot), which is why it's not enabled.

You don't have to manually attach the logfile BTW. Step 5/6 will give me the logfile automatically.

bjohas commented 5 years ago

They are both PDFs - they come up with the PDF logo, and I've check the file system location too.

retorquere commented 5 years ago

If you select Show file from the popup menu for the first one, do you see a single PDF?

bjohas commented 5 years ago

Yes ... and if I copy the PDF e.g. to Downloads, and re-import, a new item is created. On that item, the 'duplicate' function works.

retorquere commented 5 years ago

I'm not surprised by that. I'm surprised the original shows as imported URL. I'll ask on zotero-dev.

blip-bloop commented 5 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.13.50 ("import URL can also be PDF")

Install in Zotero by downloading test build 0.0.13.50, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

bjohas commented 5 years ago

Thank you! This works now also on the items that didn't work before.

Does that mean this issue is done, or do we need to wait for zotero-dev?

Would it be worth releasing 0.0.14 ?

retorquere commented 5 years ago

Done. I already got confirmation from zotero-dev.

bjohas commented 5 years ago

Thanks!