Skip to content

Commit

Permalink
Shows folders in results
Browse files Browse the repository at this point in the history
  • Loading branch information
dabeeeenster committed Jun 24, 2019
1 parent a9b9ce5 commit c252681
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/google-drive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
}

Expand Down Expand Up @@ -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|
Expand Down
Binary file added src/icons/folder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c252681

Please sign in to comment.