mirror of
https://github.com/rclone/rclone
synced 2024-11-13 12:09:47 +01:00
drive: Make --drive-trashed-only show all directories - fixes #1524
Without showing all directories it doesn't show trashed files which are in an untrashed directory. This isn't an ideal fix, but it makes the feature useable.
This commit is contained in:
parent
db5494b316
commit
39d09c04a2
@ -256,7 +256,8 @@ Skip google documents in all listings. If given, gdocs practically become invisi
|
||||
|
||||
#### --drive-trashed-only ####
|
||||
|
||||
Only show files that are in the trash
|
||||
Only show files that are in the trash. This will show trashed files
|
||||
in their original directory structure.
|
||||
|
||||
#### --drive-upload-cutoff=SIZE ####
|
||||
|
||||
|
@ -216,7 +216,11 @@ type listFn func(*drive.File) bool
|
||||
func (f *Fs) list(dirID string, title string, directoriesOnly bool, filesOnly bool, includeAll bool, fn listFn) (found bool, err error) {
|
||||
var query []string
|
||||
if !includeAll {
|
||||
query = append(query, "trashed="+strconv.FormatBool(*driveTrashedOnly))
|
||||
q := "trashed=" + strconv.FormatBool(*driveTrashedOnly)
|
||||
if *driveTrashedOnly {
|
||||
q = fmt.Sprintf("(mimeType='%s' or %s)", driveFolderType, q)
|
||||
}
|
||||
query = append(query, q)
|
||||
}
|
||||
// Search with sharedWithMe will always return things listed in "Shared With Me" (without any parents)
|
||||
// We must not filter with parent when we try list "ROOT" with drive-shared-with-me
|
||||
@ -241,10 +245,10 @@ func (f *Fs) list(dirID string, title string, directoriesOnly bool, filesOnly bo
|
||||
if filesOnly {
|
||||
query = append(query, fmt.Sprintf("mimeType!='%s'", driveFolderType))
|
||||
}
|
||||
// fmt.Printf("list Query = %q\n", query)
|
||||
list := f.svc.Files.List()
|
||||
if len(query) > 0 {
|
||||
list = list.Q(strings.Join(query, " and "))
|
||||
// fmt.Printf("list Query = %q\n", query)
|
||||
}
|
||||
if *driveListChunk > 0 {
|
||||
list = list.MaxResults(*driveListChunk)
|
||||
|
Loading…
Reference in New Issue
Block a user