Open jean-christophe-manciot opened 8 years ago
Hello @jean-christophe-manciot, thank you for the question.
My apologies that I haven't responded in ages, I've been a bit busy.
$ drive unshare <filename>
$ drive unshare --id <id>
where you can get the id by
$ drive id <filename>
The examples in the README aren't that diverse https://github.com/odeke-em/drive#unsharing, but they could definitely use some updating.
For me this doesn't work .
drive share -with-link test drive unshare "test"
gives
unshare err test: no matches found!
and the file remains shared. (Same with using id.)
Any ideas what's going wrong? @jean-christophe-manciot, did this work for you?
@bjohas: Same here on a file already shared with a link
drive stat Cisco\ ASA\ \&\ ASAv\ Major\ Features\ Excerpt.pdf
...
FileId 0B6XxNd5c3zV_ek9KNndsRHlTZ1E
Bytes 551949
Size 539.01KB
...
Name: <>
Role reader
AccountType anyone
Unsharing it does not succeed:
drive unshare Cisco\ ASA\ \&\ ASAv\ Major\ Features\ Excerpt.pdf
For roles(s)
reader
writer
commenter
File(s) to unshare:
+ Cisco ASA & ASAv Major Features Excerpt.pdf
Proceed with the changes? [Y/n]:Y
no matches found!
Confirming that nothing has changed:
drive stat Cisco\ ASA\ \&\ ASAv\ Major\ Features\ Excerpt.pdf
...
Filename Cisco ASA & ASAv Major Features Excerpt.pdf
FileId 0B6XxNd5c3zV_ek9KNndsRHlTZ1E
Bytes 551949
Size 539.01KB
...
Name: <>
Role reader
AccountType anyone
*
So to unshare, please set the accountType and roleType since right now it can't guess the intention. The Google Drive UI is intuitive to use since they've got all the presets and can infer what permissions are present but with drive we haven't done much work in the user experience side of it so you'll need to set the presets. However, these are things we could improve on.
Anyways, to get your unshare to work
$ drive unshare --role reader --type anyone Cisco\ ASA\ \&\ ASAv\ Major\ Features\ Excerpt.pdf
Could we set global values in .driverc
?
role=reader
type=anyone
None of both methods works: 1) with .driverc set
drive unshare Cisco\ ASA\ \&\ ASAv\ Major\ Features\ Excerpt.pdf
For roles(s)
reader
writer
commenter
File(s) to unshare:
+ Cisco ASA & ASAv Major Features Excerpt.pdf
Proceed with the changes? [Y/n]:Y
no matches found!
2) with options on the CLI
drive unshare --role reader --type anyone Cisco\ ASA\ \&\ ASAv\ Major\ Features\ Excerpt.pdf
Revoke access for accountType(s)
anyone
For roles(s)
reader
File(s) to unshare:
+ Cisco ASA & ASAv Major Features Excerpt.pdf
Proceed with the changes? [Y/n]:Y
no matches found!
Checking:
drive stat Cisco\ ASA\ \&\ ASAv\ Major\ Features\ Excerpt.pdf
/Missions/Certifications/Cisco/CCDP/ARCH/Jean-Christophe's Guides/ASA & ASAv Major Features/Cisco ASA & ASAv Major Features Excerpt.pdf
Filename Cisco ASA & ASAv Major Features Excerpt.pdf
FileId 0B6XxNd5c3zV_ek9KNndsRHlTZ1E
Bytes 551949
...
Copyable true
Starred true
Viewed true
Trashed false
ViewersCanDownload false
*
Name: jean-christophe Manciot <manciot.jeanchristophe@gmail.com>
Role owner
AccountType user
*
*
Name: <>
Role reader
AccountType anyone
*
Hi @jean-christophe-manciot, I've just tried this too, but for me it works. I've tried the following, and the file was first shared, and then unshared:
drive share -with-link -id ABC123 drive stat -id ABC123 drive unshare -type anyone -role reader -id ABC123 drive stat -id ABC123
Also, this works:
drive unshare -type anyone -role reader,writer -id ABC123
Maybe it depends on the account type or we need a special feature:
drive about
Name: jean-christophe Manciot
Account type: LIMITED
Bytes Used: 8513197493 (7.93GB)
Bytes Free: 9740413515 (9.07GB)
Bytes InTrash: 0 (0.00B)
Total Bytes: 18253611008 (17.00GB)
* Space used by Google Services *
...
* Maximum upload sizes per file type *
...
application/pdf 4.77TB
* 4.77TB
Feature Request limit (queries/second)
ocr 0.000000
translation 2.000000
I cannot even share from the cli with drive, after unsharing the file from the browser UI,
drive share --role reader --type anyone "Cisco ASA & ASAv Major Features Excerpt.pdf"
drive stat "Cisco ASA & ASAv Major Features Excerpt.pdf"
/Missions/Certifications/Cisco/CCDP/ARCH/Jean-Christophe's Guides/ASA & ASAv Major Features/Cisco ASA & ASAv Major Features Excerpt.pdf
Filename Cisco ASA & ASAv Major Features Excerpt.pdf
FileId 0B6XxNd5c3zV_ek9KNndsRHlTZ1E
...
*
Name: jean-christophe Manciot <manciot.jeanchristophe@gmail.com>
Role owner
AccountType user
*
There is no error code after drive share
call.
Hi @jean-christophe-manciot,
For my account I get an equivalent drive about, e.g. with "Account type: LIMITED", so I'd say that's not the reason.
Here are the commands I use. For link-only access:
drive share -with-link -role writer -id ABC123 drive share -with-link -role reader -id ABC123
Revoke:
drive unshare -type anyone -role reader,writer -id ABC123
Global access ("Find and edit/view") (same as your example)
drive share -type anyone -role reader -id ABC123 drive share -type anyone -role writer -id ABC123
and produces
Name: <> Role writer
AccountType anyone
(Or "Role reader"). To revoke
drive unshare -type anyone -role reader,writer -id ABC123
The only difference (as far as I can see) is that I'm using ids, and that I'm working on a google doc, while you have a PDF.
Strangely the 2nd set of commands also comes up with "Addressees: Anyone with the link", which is slightly misleading, as it has added discovery (compared to the first set of commands).
I have discovered the source of my issue in this thread when trying to rebuild drive: I used to compile it with "drive-gen drive-google". The keyword drive-google seems to produce a flawed binary. Rebuilding it with only "drive-gen" produces another binary which now allows me to share without issue. I can also unshare now, but as you pointed out, it needs to be done with the keywords that were used during sharing. However, I experience a slight strange glitch during unsharing without consequence:
drive share --role reader --type anyone "Cisco ASA & ASAv Major Features Excerpt.pdf"
...
successful share for Cisco ASA & ASAv Major Features Excerpt.pdf with email "", role "reader" accountType "anyone"
drive stat "Cisco ASA & ASAv Major Features Excerpt.pdf"
...
*
Name: <>
Role reader
AccountType anyone
*
drive unshare --role reader --type anyone "Cisco ASA & ASAv Major Features Excerpt.pdf"
Revoke access for accountType(s)
anyone
For roles(s)
reader
Addressees:
**+ Anyone with the link**
**+ Anyone with the link**
File(s) to unshare:
+ Cisco ASA & ASAv Major Features Excerpt.pdf
Proceed with the changes? [Y/n]:Y
successful unshare for Cisco ASA & ASAv Major Features Excerpt.pdf with email "", role "reader" accountType "anyone"
**unshare err Cisco ASA & ASAv Major Features Excerpt.pdf: no matches found!**
drive incorrectly finds 2 "+ Anyone with the link*".
I do just use
go get -u github.com/odeke-em/drive/cmd/drive
I've seen the above issue as well (duplicate "Anyone with the link"), but likewise not quite sure why this occurs. I think I saw it for -role reader,writer and had assumed that it covered both cases. The "no matches found" also occurs in other circumstances, and again my interpretation is that drive tries various combinations of permissions/types, but only finds matches for some.
Is it:
drive unshare <file_name>
ordrive unshare --with-link <file_name>
?