diff --git a/src/google-drive.rb b/src/google-drive.rb index 0af0d61..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' }, } @@ -248,7 +249,7 @@ def self.token auth_url = 'https://accounts.google.com/o/oauth2/auth?' + URI.encode_www_form({ 'client_id' => CLIENT_ID, 'redirect_uri' => REDIRECT_URL, - 'scope' => 'https://www.googleapis.com/auth/drive', + 'scope' => 'https://www.googleapis.com/auth/drive.metadata.readonly', 'response_type' => 'code', 'access_type' => 'offline', 'approval_prompt' => 'force' @@ -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 0000000..9909c41 Binary files /dev/null and b/src/icons/folder.png differ