googledrive-easy 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/googledrive-easy.rb +17 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51e1f97fea32cd6c6a79139ee346ea800e72118a838bd251bd880a5021fb25cf
|
4
|
+
data.tar.gz: 682a6aa41494fc95c9505af855ff03091cea00bd91ba359bac73d6598a8d53ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eedd2bc6b9d08d3f3a65c20ca49392363f985d4477e561f11bce8792ba621b58e02ff20efeb510446d0ea7f19a9469ca9876b6408c3eca1949615504057ddfed
|
7
|
+
data.tar.gz: cefb219271d283b419e38264e584f85c4f298a3c318531765203deba6afce49c06c072e61c40da941832e0e9bbfe3b7d1ae39c5b8bef260f74ca0c3e1c1768c9
|
data/lib/googledrive-easy.rb
CHANGED
@@ -397,7 +397,23 @@ class GoogleDrive
|
|
397
397
|
# parent folder has to be surrounded by single quotes in query
|
398
398
|
query += " and ('#{parentfolderid}' in parents)" if parentfolderid
|
399
399
|
# filename has to be surrounded by single quotes in query
|
400
|
-
|
400
|
+
|
401
|
+
if name
|
402
|
+
name.split("*").each_with_index do |part, idx|
|
403
|
+
if idx == 0 and name =~ /\*/ and part.size > 0
|
404
|
+
# If the above are true, this is the first piece, and it was followed by a *, so we should pass it in the
|
405
|
+
# format for prefix matching
|
406
|
+
query += " and (name contains \"#{part}\")"
|
407
|
+
elsif idx == 0 and !(name =~ /\*/ )
|
408
|
+
# If the above is true, this is a literal equivalence search, no wildcards should be used.
|
409
|
+
query += " and (name = \"#{part}\")"
|
410
|
+
else
|
411
|
+
# If we're here, either we had a wildcard prefix, or we're on a later part of the search term. Do a contains.
|
412
|
+
query += " and (fullText contains \"#{part}\")" if part.size > 0
|
413
|
+
end
|
414
|
+
end
|
415
|
+
end
|
416
|
+
@logger.debug("Searching with query: #{query}")
|
401
417
|
|
402
418
|
files = [ ]
|
403
419
|
next_page_token = nil
|
@@ -420,7 +436,6 @@ class GoogleDrive
|
|
420
436
|
processed_files << process_file(file)
|
421
437
|
end
|
422
438
|
|
423
|
-
# Todo: Is this still really necessary? I think the list_files function can do this server-side. Need to research.
|
424
439
|
# we have additional processing to do it a wildcard character was passed. Because Google Drive "contains" returns all portions of it.
|
425
440
|
# so we need to filter here
|
426
441
|
if name =~ /\*/ # if name contains wildcard
|