File tree 1 file changed +3
-2
lines changed
airflow/contrib/operators
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 17
17
# specific language governing permissions and limitations
18
18
# under the License.
19
19
20
+ import os
20
21
import re
21
22
import uuid
22
23
import copy
@@ -358,7 +359,7 @@ def google_cloud_to_local(self, file_name):
358
359
# Extracts bucket_id and object_id by first removing 'gs://' prefix and
359
360
# then split the remaining by path delimiter '/'.
360
361
path_components = file_name [self .GCS_PREFIX_LENGTH :].split ('/' )
361
- if path_components < 2 :
362
+ if len ( path_components ) < 2 :
362
363
raise Exception (
363
364
'Invalid Google Cloud Storage (GCS) object path: {}.'
364
365
.format (file_name ))
@@ -369,7 +370,7 @@ def google_cloud_to_local(self, file_name):
369
370
path_components [- 1 ])
370
371
file_size = self ._gcs_hook .download (bucket_id , object_id , local_file )
371
372
372
- if file_size > 0 :
373
+ if os . stat ( local_file ). st_size > 0 :
373
374
return local_file
374
375
raise Exception (
375
376
'Failed to download Google Cloud Storage GCS object: {}'
You can’t perform that action at this time.
0 commit comments