From c2526817f045387d1e373179018d7ce72e61d2f9 Mon Sep 17 00:00:00 2001 From: Ben Rometsch Date: Mon, 24 Jun 2019 14:12:34 +0100 Subject: [PATCH] Shows folders in results --- src/google-drive.rb | 6 ++++-- src/icons/folder.png | Bin 0 -> 718 bytes 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 src/icons/folder.png diff --git a/src/google-drive.rb b/src/google-drive.rb index 986ba66..f0b8e73 100755 --- a/src/google-drive.rb +++ b/src/google-drive.rb @@ -50,6 +50,7 @@ 'application/vnd.google-apps.spreadsheet' => { :path => 'icons/sheet.png' }, 'application/vnd.google-apps.presentation' => { :path => 'icons/slide.png' }, 'application/vnd.google-apps.form' => { :path => 'icons/form.png' }, + 'application/vnd.google-apps.folder' => { :path => 'icons/folder.png' }, 'application/pdf' => { :path => 'icons/dummy.pdf', :type => 'fileicon' }, } @@ -524,8 +525,9 @@ def self.latest(include_prereleases = false) folders = items.select { |item| item['mimeType'] == 'application/vnd.google-apps.folder' } folders.each { |item| parents_by_id[item['id']] = item } - files = items.reject { |item| item['mimeType'] == 'application/vnd.google-apps.folder' } - files = files.select { |item| item['title'] =~ filter_regex } + # We want to return folders too, so dont reject them + # files = items.reject { |item| item['mimeType'] == 'application/vnd.google-apps.folder' } + files = items.select { |item| item['title'] =~ filter_regex } files = files.sort { |lhs, rhs| rhs['modifiedDate'] <=> lhs['modifiedDate'] } res += files.map do |item| diff --git a/src/icons/folder.png b/src/icons/folder.png new file mode 100644 index 0000000000000000000000000000000000000000..9909c41e100685aa759ea887d4e0cd6494fd033a GIT binary patch literal 718 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7xzrV4CXb;usQf`0aK3?BGO^hL6#u zB6sHemC;CH&18f-8*l) z$im5&cHP;tpM9PabL;KmdB5-7Sp>8I27I)Pjg9-CJ$p9KT&j0+K?LLd<6q5k-q{N@ z*Tk&9?w`D3|E#lVk)n@h+57nW-`{-jHT#5je+s8gs~0@bzvElk+OXZ3-PaXle}_ib z8Lj)RQzOoJXXDY=tOje67{mo@=FXkFH^2KQn?WB#)W`fg8&2{t@A#qjK}U{xd#=%C zhD+r$ELh*&O4-L)!yn(O|HEJI_{y8T<}27Y{#$v9{eZTuS^cql_Qy{C3}Bc!D{irJ z%XFp_)=mCEqG2Kfivk0qL>q$!16KnR$MfgUPai#cw5YOjrf|Zor-u$5y3g#rp!c zOM(Q`0*JHeMm?CyY+=}w!~A0olLg;#wn=wCoo8!4czemdKI;Vst E0PmVCCIA2c literal 0 HcmV?d00001