drive: remove part of workaround for #1675

Now that https://issuetracker.google.com/issues/64468406 has been
fixed, we can remove part of the workaround which fixed #1675 -
019adc35609c2136

This will make queries marginally more efficient.  We still need the
other part of the workaround since the `=` operator is case
insensitive.
This commit is contained in:
Nick Craig-Wood 2018-06-09 12:00:50 +01:00
parent 9289aead9b
commit 4d793b8ee8

View file

@ -294,8 +294,7 @@ func (f *Fs) list(dirID string, title string, directoriesOnly bool, filesOnly bo
searchTitle = strings.Replace(searchTitle, `'`, `\'`, -1) searchTitle = strings.Replace(searchTitle, `'`, `\'`, -1)
// Convert to / for search // Convert to / for search
searchTitle = strings.Replace(searchTitle, "", "/", -1) searchTitle = strings.Replace(searchTitle, "", "/", -1)
// use contains to work around #1675 query = append(query, fmt.Sprintf("name='%s'", searchTitle))
query = append(query, fmt.Sprintf("name contains '%s'", searchTitle))
} }
if directoriesOnly { if directoriesOnly {
query = append(query, fmt.Sprintf("mimeType='%s'", driveFolderType)) query = append(query, fmt.Sprintf("mimeType='%s'", driveFolderType))
@ -343,7 +342,8 @@ OUTER:
for _, item := range files.Files { for _, item := range files.Files {
// Convert / to for listing purposes // Convert / to for listing purposes
item.Name = strings.Replace(item.Name, "/", "", -1) item.Name = strings.Replace(item.Name, "/", "", -1)
// skip items introduced by workaround (#1675) // Check the case of items is correct since
// the `=` operator is case insensitive.
if title != "" && title != item.Name { if title != "" && title != item.Name {
continue continue
} }