From 0277b551572390549b3a8f18347cce53bac85232 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Wed, 18 Mar 2015 17:26:42 +0100 Subject: [PATCH 1/2] Safe check of result.data in GDrive #1357 --- services/datasources/lib/datasources/url/gdrive.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/datasources/lib/datasources/url/gdrive.rb b/services/datasources/lib/datasources/url/gdrive.rb index 3ec8d6c0c771..4ffe0cf683a2 100644 --- a/services/datasources/lib/datasources/url/gdrive.rb +++ b/services/datasources/lib/datasources/url/gdrive.rb @@ -190,7 +190,7 @@ def get_resource(id) result = @client.execute(uri: item_data.fetch(:url)) if result.status != 200 - if result.data['error'].nil? || result.data['error']['message'].nil? + if result.data.nil? || result.data['error'].nil? || result.data['error']['message'].nil? error_message = 'Unknown error' else error_message = result.data['error']['message'] From 2703bd2d2bb7f4360ec408bafb22d3264af0c989 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Fri, 20 Mar 2015 12:19:21 +0100 Subject: [PATCH 2/2] Save state when syncing starts #1357 The state of the sync was not saved so in the first request 15 seconds after triggering a sync the frontend thought the sync was finished and did not further check on state or completion. --- app/models/synchronization/member.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/synchronization/member.rb b/app/models/synchronization/member.rb index 5c31bc8c28ce..29beaafc3389 100644 --- a/app/models/synchronization/member.rb +++ b/app/models/synchronization/member.rb @@ -133,6 +133,7 @@ def should_auto_sync? def run importer = nil self.state = STATE_SYNCING + self.store # First import is a "normal import" so still has no id, then run gets called and will get log first time # but we need this to fix old logs